Bug 1403665 - Remove " and ? from filenames. r=kmag, a=ritu
authorIan Bicking <ianb@colorstudy.com>
Wed, 27 Sep 2017 13:15:52 -0500
changeset 432218 aba6afa7f1dc90f0bfcd9948f910c311eccb7d48
parent 432217 e35fe9985d659d365ae32e0a19a8ac40a351badb
child 432219 657033ffe651d9885c5004ef3aa0d4f906b526ff
push id7907
push userryanvm@gmail.com
push dateThu, 05 Oct 2017 19:59:03 +0000
treeherdermozilla-beta@178de8c0b3e4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag, ritu
bugs1403665
milestone57.0
Bug 1403665 - Remove " and ? from filenames. r=kmag, a=ritu This is an export of this commit: https://github.com/mozilla-services/screenshots/pull/3524/commits/42a561d6ad6e160628344d271f9244df5179e8e0 And fixes this Screenshots bug: https://github.com/mozilla-services/screenshots/issues/3517 MozReview-Commit-ID: GPkfNCFGflZ
browser/extensions/screenshots/webextension/build/shot.js
--- a/browser/extensions/screenshots/webextension/build/shot.js
+++ b/browser/extensions/screenshots/webextension/build/shot.js
@@ -360,17 +360,17 @@ class AbstractShot {
       assertOrigin(val);
     }
     this._origin = val || undefined;
   }
 
   get filename() {
     let filenameTitle = this.title;
     let date = new Date(this.createdDate);
-    filenameTitle = filenameTitle.replace(/[:\\<>/!@&*.|\n\r\t]/g, " ");
+    filenameTitle = filenameTitle.replace(/[:\\<>/!@&?"*.|\n\r\t]/g, " ");
     filenameTitle = filenameTitle.replace(/\s{1,4000}/g, " ");
     let clipFilename = `Screenshot-${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${filenameTitle}`;
     const clipFilenameBytesSize = clipFilename.length * 2; // JS STrings are UTF-16
     if (clipFilenameBytesSize > 251) { // 255 bytes (Usual filesystems max) - 4 for the ".png" file extension string
       const excedingchars = (clipFilenameBytesSize - 246) / 2; // 251 - 5 for ellipsis "[...]"
       clipFilename = clipFilename.substring(0, clipFilename.length - excedingchars);
       clipFilename = clipFilename + '[...]';
     }