Permalink
Browse files

Make correct file names for "New Script"s.

  • Loading branch information...
arantius committed Jan 8, 2012
1 parent d3ce580 commit db558672c16c6bddd43dda5dea12150a6e808895
Showing with 4 additions and 2 deletions.
  1. +2 −2 content/newscript.js
  2. +2 −0 modules/remoteScript.js
View
@@ -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
@@ -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;

0 comments on commit db55867

Please sign in to comment.