File tree Expand file tree Collapse file tree
src/main/java/de/unirostock/sems/cbarchive/web/rest Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -897,9 +897,13 @@ else if( !path.endsWith("/") )
897897 // remove leading slash
898898 if ( fileName .startsWith ("/" ) )
899899 fileName = fileName .substring (1 );
900-
900+
901+ // figuring out a good temp file name (seems like URIs don't like Brackets)
902+ String uploadedFileName = file .getFormDataContentDisposition ().getFileName ();
903+ uploadedFileName = uploadedFileName .replaceAll ("[^A-Za-z0-9]" , "_" );
904+
901905 // copy the stream to a temp file
902- java .nio .file .Path temp = Files .createTempFile ( Fields .TEMP_FILE_PREFIX , file . getFormDataContentDisposition (). getFileName () );
906+ java .nio .file .Path temp = Files .createTempFile ( Fields .TEMP_FILE_PREFIX , uploadedFileName );
903907 // write file to disk
904908 OutputStream output = new FileOutputStream ( temp .toFile () );
905909 InputStream input = file .getEntityAs (InputStream .class );
You can’t perform that action at this time.
0 commit comments