[ci] format
This commit is contained in:
parent
637919c8b6
commit
c4203ce0fc
4 changed files with 12 additions and 10 deletions
|
@ -178,9 +178,10 @@ async function generatePath(
|
|||
|
||||
// If a base path was provided, append it to the site URL. This ensures that
|
||||
// all injected scripts and links are referenced relative to the site and subpath.
|
||||
const site = astroConfig.base && astroConfig.base !== './'
|
||||
? joinPaths(astroConfig.site?.toString() || 'http://localhost/', astroConfig.base)
|
||||
: astroConfig.site;
|
||||
const site =
|
||||
astroConfig.base && astroConfig.base !== './'
|
||||
? joinPaths(astroConfig.site?.toString() || 'http://localhost/', astroConfig.base)
|
||||
: astroConfig.site;
|
||||
const links = createLinkStylesheetElementSet(linkIds.reverse(), site);
|
||||
const scripts = createModuleScriptElementWithSrcSet(hoistedId ? [hoistedId] : [], site);
|
||||
|
||||
|
|
|
@ -45,4 +45,4 @@ function isString(path: unknown): path is string {
|
|||
|
||||
export function joinPaths(...paths: (string | undefined)[]) {
|
||||
return paths.filter(isString).map(trimSlashes).join('/');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,11 +112,12 @@ async function handle404Response(
|
|||
html = subpathNotUsedTemplate(devRoot, pathname);
|
||||
} else {
|
||||
// HACK: redirect without the base path for assets in publicDir
|
||||
const redirectTo =
|
||||
req.method === 'GET'
|
||||
&& config.base && config.base !== './'
|
||||
&& pathname.startsWith(config.base)
|
||||
&& pathname.replace(config.base, '/');
|
||||
const redirectTo =
|
||||
req.method === 'GET' &&
|
||||
config.base &&
|
||||
config.base !== './' &&
|
||||
pathname.startsWith(config.base) &&
|
||||
pathname.replace(config.base, '/');
|
||||
|
||||
if (redirectTo && redirectTo !== '/') {
|
||||
const response = new Response(null, {
|
||||
|
|
|
@ -8,7 +8,7 @@ function addLeadingSlash(path) {
|
|||
|
||||
function removeBasePath(path) {
|
||||
// `/subpath` is defined in the test fixture's Astro config
|
||||
return path.replace('/subpath', '')
|
||||
return path.replace('/subpath', '');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue