mirror of
https://github.com/tauri-apps/tauri-inliner.git
synced 2026-02-04 02:31:19 +01:00
feat: inspect folder structure if asset not found
This commit is contained in:
@@ -37,7 +37,11 @@ module.exports = function get(url, options) {
|
||||
cache[url] = fs.readFile(fileName).catch(function (error) {
|
||||
if (error.code === 'ENOENT' || error.code === 'ENAMETOOLONG') {
|
||||
debug(error.code + ': ' + base + ', trying decodeURI');
|
||||
return fs.readFile(decodeURI(url));
|
||||
return fs.readFile(decodeURI(url)).catch(function (error) {
|
||||
const nextTry = url.split('/').slice(1).join('/');
|
||||
debug(error.code + ': ' + base + ', trying ' + nextTry);
|
||||
return get.call(inliner, nextTry, options).then(res => res.body);
|
||||
});
|
||||
}
|
||||
throw error;
|
||||
}).then(function read(body) {
|
||||
|
||||
1
test/fixtures/script-local-relative-public-path.result.html
vendored
Normal file
1
test/fixtures/script-local-relative-public-path.result.html
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>public path script</title> </head> <body> <script>function surroundWithScriptTag(r){return"<script>"+r+"<\/script>"}for(var array=[4,8,15,16,23,42],i=0;i<array.length;i++)console.log(array[i]);</script> </body> </html>
|
||||
10
test/fixtures/script-local-relative-public-path.src.html
vendored
Normal file
10
test/fixtures/script-local-relative-public-path.src.html
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>public path script</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="/test/inner/public-path/script-local.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -111,6 +111,7 @@ test('inliner fixtures', function fixtureTests(t) {
|
||||
error.message += ' @ ' + basename;
|
||||
return reject(error);
|
||||
}
|
||||
|
||||
t.equal(html.trim(), results[i].trim(), basename + ' matches');
|
||||
debug('result', html.trim());
|
||||
// debug('expected', results[i].trim());
|
||||
|
||||
Reference in New Issue
Block a user