File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99
1010### Fixed
1111- swagger lint action
12-
12+ - When downloading a file with a ` ' ` in the name it would save the file as blob
13+ -
1314### Changed
1415- Changed ` Enabled By SuperAdmin ` to read ` Enabled by Server Admin ` [ #344 ] ( https://github.com/clowder-framework/clowder/issues/344 )
1516
Original file line number Diff line number Diff line change @@ -856,37 +856,20 @@ object FileUtils {
856856 // Download CONTENT-DISPOSITION encoding
857857 //
858858 def encodeAttachment (filename : String , userAgent : String ) : String = {
859- val filenameStar = if (userAgent.indexOf(" MSIE" ) > - 1 ) {
860- URLEncoder .encode(filename, " UTF-8" )
861- } else if (userAgent.indexOf(" Edge" ) > - 1 ){
862- MimeUtility .encodeText(filename
863- .replaceAll(" ," ," %2C" )
864- .replaceAll(" \" " ," %22" )
865- .replaceAll(" /" ," %2F" )
866- .replaceAll(" =" ," %3D" )
867- .replaceAll(" &" ," %26" )
868- .replaceAll(" :" ," %3A" )
869- .replaceAll(" ;" ," %3B" )
870- .replaceAll(" \\ ?" ," %3F" )
871- .replaceAll(" \\ *" ," %2A" )
859+ val filenameStar = MimeUtility .encodeText(filename
860+ .replaceAll(" %" ," %25" )
861+ .replaceAll(" " ," %20" )
862+ .replaceAll(" \" " ," %22" )
863+ .replaceAll(" '" ," %27" )
864+ .replaceAll(" ," ," %2C" )
865+ .replaceAll(" /" ," %2F" )
866+ .replaceAll(" =" ," %3D" )
867+ .replaceAll(" :" ," %3A" )
868+ .replaceAll(" ;" ," %3B" )
869+ .replaceAll(" \\ *" ," %2A" )
872870 ," utf-8" ," Q" )
873- } else {
874- MimeUtility .encodeText(filename
875- .replaceAll(" %" ," %25" )
876- .replaceAll(" " ," %20" )
877- .replaceAll(" \" " ," %22" )
878- .replaceAll(" ," ," %2C" )
879- .replaceAll(" /" ," %2F" )
880- .replaceAll(" =" ," %3D" )
881- .replaceAll(" :" ," %3A" )
882- .replaceAll(" ;" ," %3B" )
883- .replaceAll(" \\ *" ," %2A" )
884- ," utf-8" ," Q" )
885- }
886- Logger .debug(userAgent + " : " + filenameStar)
887871
888872 // Return the complete attachment header info
889873 " attachment; filename*=UTF-8''" + filenameStar
890874 }
891-
892875}
You can’t perform that action at this time.
0 commit comments