aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranekos2009-11-28 07:12:24 +0000
committeranekos2009-11-28 07:12:24 +0000
commit1053ac3441fabf260ad50e61b2ea1e76cea7aed7 (patch)
tree86d80f63684ad64036f9d937bfe597d04c049c75
parent21c89bc56f1104a4aff9f6ec34010047d948ad55 (diff)
downloadvimperator-plugins-1053ac3441fabf260ad50e61b2ea1e76cea7aed7.tar.bz2
不正なファイル名になったりするのを修正
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36022 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r--zip-de-download.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/zip-de-download.js b/zip-de-download.js
index a4a1cb3..8e642d3 100644
--- a/zip-de-download.js
+++ b/zip-de-download.js
@@ -1,5 +1,5 @@
let INFO =
-<plugin name="zip-de-download" version="0.5"
+<plugin name="zip-de-download" version="0.5.1"
href=""
summary="ZIPでダウンロードするお"
xmlns="http://vimperator.org/namespaces/liberator">
@@ -151,6 +151,10 @@ __proto__ = (function(){
liberator.modules.services.get("directory").get("Home", Ci.nsIFile).path;
return getFile(path);
}
+ function fixFilename(filename){
+ const badChars = /[\\\/:;\*\?\"\<\>\|\#]/g;
+ return liberator.has('windows') ? filename.replace(badChars, '_') : filename;
+ }
let self = {
downloadZip: function(path, urls, comment, isAppend){
let zipW = new zipWriter();
@@ -221,7 +225,7 @@ __proto__ = (function(){
liberator.assert(info.xpath, "not registered in SITE_IFO");
let urls = this.getURLs(info);
- let title = liberator.modules.buffer.title;
+ let title = fixFilename(liberator.modules.buffer.title);
let comment = [title, liberator.modules.buffer.URL].join("\n");
let file;
if (!zipPath){