Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make correct file names for "New Script"s.

  • Loading branch information...
commit db558672c16c6bddd43dda5dea12150a6e808895 1 parent d3ce580
@arantius arantius authored
Showing with 4 additions and 2 deletions.
  1. +2 −2 content/newscript.js
  2. +2 −0  modules/remoteScript.js
View
4 content/newscript.js
@@ -42,8 +42,8 @@ function doInstall() {
var scope = {};
Components.utils.import('resource://greasemonkey/remoteScript.js', scope);
var remoteScript = new scope.RemoteScript();
- var tempFile = GM_util.getTempFile(
- remoteScript._tempDir, scope.cleanFilename(script.name, 'gm_script'));
+ var tempFileName = scope.cleanFilename(script.name, 'gm_script') + '.user.js';
+ var tempFile = GM_util.getTempFile(remoteScript._tempDir, tempFileName);
GM_util.writeToFile(scriptSrc, tempFile, function() {
// install this script
remoteScript.setScript(script, tempFile);
View
2  modules/remoteScript.js
@@ -30,6 +30,8 @@ function cleanFilename(aFilename, aDefault) {
// Blacklist problem characters (slashes, colons, etc.).
var filename = (aFilename || aDefault).replace(
disallowedFilenameCharacters, '');
+ // Make whitespace readable.
+ filename = filename.replace(/\s+/g, '_');
// Ensure that it's something.
if (!filename) filename = aDefault || 'unknown';
return filename;
Please sign in to comment.
Something went wrong with that request. Please try again.