File tree 3 files changed +19
-5
lines changed
java/com/databasepreservation/common/server
3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,8 @@ public class ViewerConfiguration extends ViewerAbstractConfiguration {
150
150
public static final String PRESENTATION_EXTERNAL_SERVICE_NAME = "ui.iiif_viewer.presentation.service_name" ;
151
151
public static final String VIEWER_ENABLED = "ui.iiif_viewer.enabled" ;
152
152
153
+ public static final String OVERWRITE_EXISTING_FILE = "overwrite.existing.file" ;
154
+
153
155
private static boolean instantiatedWithoutErrors = true ;
154
156
private static String applicationEnvironment = ViewerConstants .APPLICATION_ENV_SERVER ;
155
157
Original file line number Diff line number Diff line change 7
7
*/
8
8
package com .databasepreservation .common .server .storage .fs ;
9
9
10
+ import com .databasepreservation .common .server .ViewerConfiguration ;
10
11
import com .databasepreservation .common .server .storage .ContentPayload ;
11
12
12
13
import java .io .IOException ;
@@ -31,11 +32,17 @@ public InputStream createInputStream() throws IOException {
31
32
return Files .newInputStream (path );
32
33
}
33
34
34
- @ Override
35
- public void writeToPath (Path outPath ) throws IOException {
36
- // Files.copy(path, outPath, StandardCopyOption.REPLACE_EXISTING);
37
- Files .copy (path , outPath );
35
+ @ Override
36
+ public void writeToPath (Path outPath ) throws IOException {
37
+ boolean allowOverwrite = ViewerConfiguration .getInstance ().getViewerConfigurationAsBoolean (false ,
38
+ ViewerConfiguration .OVERWRITE_EXISTING_FILE );
39
+
40
+ if (allowOverwrite ) {
41
+ Files .copy (path , outPath , StandardCopyOption .REPLACE_EXISTING );
42
+ } else {
43
+ Files .copy (path , outPath );
38
44
}
45
+ }
39
46
40
47
@ Override
41
48
public URI getURI () throws IOException , UnsupportedOperationException {
Original file line number Diff line number Diff line change @@ -224,4 +224,9 @@ ui.searchAll.defaultSelection=all
224
224
# Default: "UTC"
225
225
# Possible values: Any valid Java ZoneId string
226
226
# #############################################
227
- permissions.expiry.zoneId.override =UTC
227
+ permissions.expiry.zoneId.override =UTC
228
+
229
+ # ##############################################
230
+ # Overwrite existing file when creating siard file
231
+ # #############################################
232
+ overwrite.existing.file =false
You can’t perform that action at this time.
0 commit comments