|
@@ -50,7 +50,8 @@ export {
|
|
|
downloadPage,
|
|
downloadPage,
|
|
|
saveToGDrive,
|
|
saveToGDrive,
|
|
|
saveToGitHub,
|
|
saveToGitHub,
|
|
|
- saveWithWebDAV
|
|
|
|
|
|
|
+ saveWithWebDAV,
|
|
|
|
|
+ encodeSharpCharacter
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
async function onMessage(message, sender) {
|
|
async function onMessage(message, sender) {
|
|
@@ -126,15 +127,15 @@ async function downloadTabPage(message, tab) {
|
|
|
async function downloadContent(contents, tab, incognito, message) {
|
|
async function downloadContent(contents, tab, incognito, message) {
|
|
|
try {
|
|
try {
|
|
|
if (message.saveWithWebDAV) {
|
|
if (message.saveWithWebDAV) {
|
|
|
- await saveWithWebDAV(message.taskId, message.filename, contents.join(""), message.webDAVURL, message.webDAVUser, message.webDAVPassword);
|
|
|
|
|
|
|
+ await saveWithWebDAV(message.taskId, encodeSharpCharacter(message.filename), contents.join(""), message.webDAVURL, message.webDAVUser, message.webDAVPassword);
|
|
|
} else if (message.saveToGDrive) {
|
|
} else if (message.saveToGDrive) {
|
|
|
- await saveToGDrive(message.taskId, message.filename, new Blob(contents, { type: MIMETYPE_HTML }), {
|
|
|
|
|
|
|
+ await saveToGDrive(message.taskId, encodeSharpCharacter(message.filename), new Blob(contents, { type: MIMETYPE_HTML }), {
|
|
|
forceWebAuthFlow: message.forceWebAuthFlow
|
|
forceWebAuthFlow: message.forceWebAuthFlow
|
|
|
}, {
|
|
}, {
|
|
|
onProgress: (offset, size) => ui.onUploadProgress(tab.id, offset, size)
|
|
onProgress: (offset, size) => ui.onUploadProgress(tab.id, offset, size)
|
|
|
});
|
|
});
|
|
|
} else if (message.saveToGitHub) {
|
|
} else if (message.saveToGitHub) {
|
|
|
- await (await saveToGitHub(message.taskId, message.filename, contents.join(""), message.githubToken, message.githubUser, message.githubRepository, message.githubBranch)).pushPromise;
|
|
|
|
|
|
|
+ await (await saveToGitHub(message.taskId, encodeSharpCharacter(message.filename), contents.join(""), message.githubToken, message.githubUser, message.githubRepository, message.githubBranch)).pushPromise;
|
|
|
} else if (message.saveWithCompanion) {
|
|
} else if (message.saveWithCompanion) {
|
|
|
await companion.save({
|
|
await companion.save({
|
|
|
filename: message.filename,
|
|
filename: message.filename,
|
|
@@ -171,6 +172,10 @@ async function downloadContent(contents, tab, incognito, message) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function encodeSharpCharacter(path) {
|
|
|
|
|
+ return path.replace(/#/g, "%23");
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function getRegExp(string) {
|
|
function getRegExp(string) {
|
|
|
return string.replace(REGEXP_ESCAPE, "\\$1");
|
|
return string.replace(REGEXP_ESCAPE, "\\$1");
|
|
|
}
|
|
}
|
|
@@ -324,7 +329,7 @@ async function downloadPage(pageData, options) {
|
|
|
if (downloadData.filename.startsWith("/")) {
|
|
if (downloadData.filename.startsWith("/")) {
|
|
|
downloadData.filename = downloadData.filename.substring(1);
|
|
downloadData.filename = downloadData.filename.substring(1);
|
|
|
}
|
|
}
|
|
|
- downloadData.filename = "file:///" + downloadData.filename.replace(/#/g, "%23");
|
|
|
|
|
|
|
+ downloadData.filename = "file:///" + encodeSharpCharacter(downloadData.filename);
|
|
|
}
|
|
}
|
|
|
await bookmarks.update(pageData.bookmarkId, { url: downloadData.filename });
|
|
await bookmarks.update(pageData.bookmarkId, { url: downloadData.filename });
|
|
|
}
|
|
}
|