mirror of
https://github.com/10h30/wordpress-export-to-markdown.git
synced 2026-07-11 18:56:14 +09:00
Catch URIError
This commit is contained in:
+8
-1
@@ -1,5 +1,12 @@
|
||||
function getFilenameFromUrl(url) {
|
||||
return decodeURIComponent(url.split('/').slice(-1)[0]);
|
||||
let filename = url.split('/').slice(-1)[0];
|
||||
try {
|
||||
filename = decodeURIComponent(filename)
|
||||
} catch (ex) {
|
||||
// filename could not be decoded because of improper encoding with %
|
||||
// leave filename as-is and continue
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
exports.getFilenameFromUrl = getFilenameFromUrl;
|
||||
|
||||
Reference in New Issue
Block a user