feat: ignore search param in resolving .html files
This commit is contained in:
parent
677ac408da
commit
cc60a683ac
1 changed files with 6 additions and 1 deletions
|
@ -49,6 +49,10 @@ export function useMcFlyRoute({ config, storage }) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPurePath(path) {
|
||||||
|
return path.split('?')[0]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the correct HTML depending on the path requested
|
* Gets the correct HTML depending on the path requested
|
||||||
* @param {string} path
|
* @param {string} path
|
||||||
|
@ -56,7 +60,8 @@ export function useMcFlyRoute({ config, storage }) {
|
||||||
* @returns {Promise<StorageValue>}
|
* @returns {Promise<StorageValue>}
|
||||||
*/
|
*/
|
||||||
async function getHtml(path, storage) {
|
async function getHtml(path, storage) {
|
||||||
const rawPath = path[path.length - 1] === "/" ? path.slice(0, -1) : path;
|
const purePath = getPurePath(path);
|
||||||
|
const rawPath = purePath[purePath.length - 1] === "/" ? purePath.slice(0, -1) : purePath;
|
||||||
const filename = rawPath === "" ? "/index.html" : `${rawPath}.html`;
|
const filename = rawPath === "" ? "/index.html" : `${rawPath}.html`;
|
||||||
const fallback = getPath(rawPath + "/index.html");
|
const fallback = getPath(rawPath + "/index.html");
|
||||||
const filePath = getPath(filename);
|
const filePath = getPath(filename);
|
||||||
|
|
Loading…
Reference in a new issue