ui: update polyfill

This commit is contained in:
undefined committed 2024-06-29 22:46:54 +08:00
1 parent 4ebd4235a5
commit 979b8ce5af
7 files changed
+44 -13

No files matched your search

+11 -1
View File
@@ -144,8 +144,18 @@ export async function apply(ctx: Context) {
});
if (process.env.HYDRO_CLI) return;
ctx.inject(['server'], ({ server, on }) => {
let endpoint = builtinConfig.file.endPoint;
if (builtinConfig.file.type === 's3' && !builtinConfig.file.pathStyle) {
try {
const parsed = new URL(builtinConfig.file.endPoint);
parsed.hostname = `${builtinConfig.file.bucket}.${parsed.hostname}`;
endpoint = parsed.toString();
} catch (e) {
logger.warn('Failed to parse file endpoint');
}
}
const proxyMiddleware = proxy('/fs', {
target: builtinConfig.file.endPoint,
target: endpoint,
changeOrigin: true,
rewrite: (p) => p.replace('/fs', ''),
});