Skip to content

Commit 63634e9

Browse files
committed
Improved file name sanitizing
1 parent a2cf722 commit 63634e9

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

javascripts/upload.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function Upload(file, o, key) {
77

88
this.key = key;
99
this.file = file;
10-
this.name = file.name.replace(/[^a-z.A-Z0-9\-_]+/g, "_");
10+
this.name = file.name.replace(/[^a-z.A-Z0-9\-_]+/g, "_").replace("_.", ".").replace(/^_/, "");
1111
this.size = file.size;
1212
this.type = file.type;
1313
this.Etags = [];

lib/s3_multipart/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module S3Multipart
2-
VERSION = "0.0.11.8"
2+
VERSION = "0.0.11.9"
33
BREAKING_CHANGES = {
44
:"0.0.10.2" => 'Modifications made to the database table used by the gem are now handled by migrations. If you are upgrading versions, run `rails g s3_multipart:install_new_migrations` followed by `rake db:migrate`. Fresh installs do not require subsequent migrations. The current version must now also be passed in to the gem\'s configuration function to alert you of breaking changes. This is done by setting a revision yml variable. See the section regarding the aws.yml file in the readme section below (just before "Getting Started").'
55
}

vendor/assets/javascripts/s3_multipart/lib.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ function Upload(file, o, key) {
404404

405405
this.key = key;
406406
this.file = file;
407-
this.name = file.name.replace(/[^a-z.A-Z0-9\-_]+/g, "_");
407+
this.name = file.name.replace(/[^a-z.A-Z0-9\-_]+/g, "_").replace("_.", ".").replace(/^_/, "");
408408
this.size = file.size;
409409
this.type = file.type;
410410
this.Etags = [];

vendor/assets/javascripts/s3_multipart/lib.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)