소스 검색

Fix #43: Validate special characters in filename before rendering caption

Kartik Visweswaran 10 년 전
부모
커밋
18f76c961d
3개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 2
      CHANGE.md
  2. 4 1
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js

+ 3 - 2
CHANGE.md

@@ -2,9 +2,10 @@ version 2.6.0
 =============
 **Date:** 15-Oct-2014
 
-- (enh #42): Enhance plugin to configure the `elErrorContainer` for displaying validation errors.
-- Templatize errorContainer for display within the preview window.
 - (bug #40): More correct fix for IE (ver < 11) inability to clear fileinput values.
+- Templatize errorContainer for display within the preview window.
+- (enh #42): Enhance plugin to configure the `elErrorContainer` for displaying validation errors.
+- (bug #43): Validate special characters in filename before generating caption.
 
 version 2.5.0
 =============

+ 4 - 1
js/fileinput.js

@@ -623,8 +623,11 @@
             }
             readFile(0);
         },
+        slug: function (text) {
+            return isEmpty(text) ? '' : text.replace(/[^\w-. ]+/g,'');
+        },
         change: function (e) {
-            var self = this, $el = self.$element, label = $el.val().replace(/\\/g, '/').replace(/.*\//, ''),
+            var self = this, $el = self.$element, label = self.slug($el.val()),
                 total = 0, $preview = self.$preview, files = $el.get(0).files, msgSelected = self.msgSelected,
                 numFiles = !isEmpty(files) ? (files.length + self.initialPreviewCount) : 1, tfiles;
             self.hideFileIcon();

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
js/fileinput.min.js


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.