Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
Do same for local uploads
istarkov06dfe21c6394
diff --git a/packages/asset-uploader/src/targets/fs/upload.ts b/packages/asset-uploader/src/targets/fs/upload.tsindex 18e706ceb4..dfcd794e7d 100644--- a/packages/asset-uploader/src/targets/fs/upload.ts+++ b/packages/asset-uploader/src/targets/fs/upload.ts@@ -10,6 +10,7 @@ import { createMany } from "../../db";import { FILE_DIRECTORY } from "./file-path";import { Asset } from "../../types";import { getUniqueFilename } from "../../utils/get-unique-filename";+import { sanitizeS3Key } from "../../utils/sanitize-s3-key";const AssetsFromFs = z.array(z.instanceof(NodeOnDiskFile));@@ -25,7 +26,7 @@ export const uploadToFs = async ({const uploadHandler = await unstable_createFileUploadHandler({maxPartSize: maxSize,directory: FILE_DIRECTORY,- file: ({ filename }) => getUniqueFilename(filename),+ file: ({ filename }) => getUniqueFilename(sanitizeS3Key(filename)),});const formData = await unstable_parseMultipartFormData(diff --git a/packages/asset-uploader/src/utils/get-asset-path.ts b/packages/asset-uploader/src/utils/get-asset-path.tsindex 8490fd566e..54b8bb64fd 100644--- a/packages/asset-uploader/src/utils/get-asset-path.ts+++ b/packages/asset-uploader/src/utils/get-asset-path.ts@@ -9,11 +9,7 @@ export const getAssetPath = (asset: DbAsset) => {if (asset.location === Location.FS) {const splitPath = fsEnv.FILE_UPLOAD_PATH.split("public");const locUrl = new URL(- path.join(- "/",- splitPath[splitPath.length - 1],- encodeURIComponent(asset.name)- ),+ path.join("/", splitPath[splitPath.length - 1], asset.name),// Hostname here is not important"http://localhost");