Skip to content

Commit de0e4c4

Browse files
authored
Merge pull request #6924 from IQSS/4813-allow-duplicate-files
4813 allow duplicate files
2 parents 78527a2 + 57ab613 commit de0e4c4

18 files changed

Lines changed: 644 additions & 221 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
We should note that duplicate files are now allowed, and installations may want to contact people now that this is available. Point to rules in the Guides.

doc/sphinx-guides/source/user/dataset-management.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ You can upload files to a dataset while first creating that dataset. You can als
7373

7474
Certain file types in Dataverse are supported by additional functionality, which can include downloading in different formats, previews, file-level metadata preservation, file-level data citation with UNFs, and exploration through data visualization and analysis. See the :ref:`File Handling <file-handling>` section of this page for more information.
7575

76-
7776
HTTP Upload
7877
-----------
7978

@@ -147,6 +146,20 @@ File Handling
147146

148147
Certain file types in Dataverse are supported by additional functionality, which can include downloading in different formats, previews, file-level metadata preservation, file-level data citation; and exploration through data visualization and analysis. See the sections below for information about special functionality for specific file types.
149148

149+
.. _duplicate-files:
150+
151+
Duplicate Files
152+
===============
153+
154+
Beginning with Dataverse 5.0, the way Dataverse handles duplicate files (filename and checksums) is changing to be more flexible. Specifically:
155+
156+
- Files with the same checksum can be included in a dataset, even if the files are in the same directory.
157+
- Files with the same filename can be included in a dataset as long as the files are in different directories.
158+
- If a user uploads a file to a directory where a file already exists with that directory/filename combination, Dataverse will adjust the file path and names by adding "-1" or "-2" as applicable. This change will be visible in the list of files being uploaded.
159+
- If the directory or name of an existing or newly uploaded file is edited in such a way that would create a directory/filename combination that already exists, Dataverse will display an error.
160+
- If a user attempts to replace a file with another file that has the same checksum, an error message will be displayed and the file will not be able to be replaced.
161+
- If a user attempts to replace a file with a file that has the same checksum as a different file in the dataset, a warning will be displayed.
162+
150163
File Previews
151164
-------------
152165

@@ -268,7 +281,7 @@ Variable Metadata can be edited directly through an API call (:ref:`API Guide: E
268281
File Path
269282
---------
270283

271-
The File Path metadata field is Dataverse's way of representing a file's location in a folder structure. When a user uploads a .zip file containing a folder structure, Dataverse automatically fills in the File Path information for each file contained in the .zip. If a user downloads the full dataset or a selection of files from it, they will receive a folder structure with each file positioned according to its File Path.
284+
The File Path metadata field is Dataverse's way of representing a file's location in a folder structure. When a user uploads a .zip file containing a folder structure, Dataverse automatically fills in the File Path information for each file contained in the .zip. If a user downloads the full dataset or a selection of files from it, they will receive a folder structure with each file positioned according to its File Path. Only one file with a given path and name may exist in a dataset. Editing a file to give it the same path and name as another file already existing in the dataset will cause an error.
272285

273286
A file's File Path can be manually added or edited on the Edit Files page. Changing a file's File Path will change its location in the folder structure that is created when a user downloads the full dataset or a selection of files from it.
274287

src/main/java/edu/harvard/iq/dataverse/DataFile.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,37 @@ public boolean isDeleted() {
254254
public void setDeleted(boolean deleted) {
255255
this.deleted = deleted;
256256
}
257+
258+
/*
259+
For use during file upload so that the user may delete
260+
files that have already been uploaded to the current dataset version
261+
*/
262+
263+
@Transient
264+
private boolean markedAsDuplicate;
265+
266+
public boolean isMarkedAsDuplicate() {
267+
return markedAsDuplicate;
268+
}
269+
270+
public void setMarkedAsDuplicate(boolean markedAsDuplicate) {
271+
this.markedAsDuplicate = markedAsDuplicate;
272+
}
273+
274+
@Transient
275+
private String duplicateFilename;
276+
277+
public String getDuplicateFilename() {
278+
return duplicateFilename;
279+
}
280+
281+
public void setDuplicateFilename(String duplicateFilename) {
282+
this.duplicateFilename = duplicateFilename;
283+
}
284+
285+
286+
287+
257288

258289
/**
259290
* All constructors should use this method

0 commit comments

Comments
 (0)