Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix: image preview on hover
Brad Barbinc847104032b0
diff --git a/apps/carbon/app/components/Documents.tsx b/apps/carbon/app/components/Documents.tsxindex da128c3351..f132c48320 100644--- a/apps/carbon/app/components/Documents.tsx+++ b/apps/carbon/app/components/Documents.tsx@@ -307,6 +307,7 @@ const Documents = ({)}{allFiles.map((file) => {const type = getDocumentType(file.name);+ const isPreviewable = ["PDF", "Image"].includes(type);return (<Tr key={file.id}><Td>@@ -316,7 +317,7 @@ const Documents = ({className="font-medium"onClick={() => download(file)}>- {["PDF", "Image"].includes(type) ? (+ {isPreviewable ? (<DocumentPreviewbucket="private"pathToFile={getReadPath(file)}diff --git a/apps/carbon/app/modules/sales/ui/Opportunity/OpportunityDocuments.tsx b/apps/carbon/app/modules/sales/ui/Opportunity/OpportunityDocuments.tsxindex fb654da369..ed5ea2c590 100644--- a/apps/carbon/app/modules/sales/ui/Opportunity/OpportunityDocuments.tsx+++ b/apps/carbon/app/modules/sales/ui/Opportunity/OpportunityDocuments.tsx@@ -206,6 +206,10 @@ const DraggableCell = ({}: undefined;+ const isPreviewable = ["PDF", "Image"].includes(+ getDocumentType(attachment.name)+ );+return (<Td ref={setNodeRef} style={style} {...attributes} {...listeners}><HStack>@@ -214,7 +218,7 @@ const DraggableCell = ({)}<DocumentIcon type={getDocumentType(attachment.name)} /><span className="font-medium" onClick={() => download(attachment)}>- {["PDF", "Image"].includes(getDocumentType(attachment.name)) ? (+ {isPreviewable ? (<DocumentPreviewbucket="private"pathToFile={getPath(attachment)}diff --git a/apps/carbon/app/routes/file+/preview+/$bucket.$.tsx b/apps/carbon/app/routes/file+/preview+/$bucket.$.tsxindex 51957f7745..dee2b1382d 100644--- a/apps/carbon/app/routes/file+/preview+/$bucket.$.tsx+++ b/apps/carbon/app/routes/file+/preview+/$bucket.$.tsx@@ -25,11 +25,13 @@ const supportedFileTypes: Record<string, string> = {export let loader = async ({ request, params }: LoaderFunctionArgs) => {const { client } = await requirePermissions(request, {});const { bucket } = params;- const path = params["*"];+ let path = params["*"];if (!bucket) throw new Error("Bucket not found");if (!path) throw new Error("Path not found");+ path = decodeURIComponent(path);+const fileType = path.split(".").pop()?.toLowerCase();if (diff --git a/apps/carbon/app/routes/file+/preview+/image.tsx b/apps/carbon/app/routes/file+/preview+/image.tsxindex fd5ea5ba92..1682054865 100644--- a/apps/carbon/app/routes/file+/preview+/image.tsx+++ b/apps/carbon/app/routes/file+/preview+/image.tsx@@ -9,7 +9,7 @@ export let loader = async ({ request }: LoaderFunctionArgs) => {});const url = new URL(request.url);const searchParams = new URLSearchParams(url.search);- const file = searchParams.get("file");+ const file = decodeURIComponent(searchParams.get("file") ?? "");if (!file) throw new Error("file not found");const body = `@@ -31,7 +31,7 @@ export let loader = async ({ request }: LoaderFunctionArgs) => {</style></head><body>- <img src=${path.to.file.previewFile(file)} />+ <img src="${path.to.file.previewFile(file)}" /></body></html>`;const headers = new Headers({ "Content-Type": "text/html" });diff --git a/apps/carbon/app/utils/string.ts b/apps/carbon/app/utils/string.tsindex df66c2db56..cad3384014 100644--- a/apps/carbon/app/utils/string.ts+++ b/apps/carbon/app/utils/string.ts@@ -4,8 +4,8 @@ export const capitalize = (words: string) => {};export function stripSpecialCharacters(inputString: string) {- // Use a regular expression to replace all non-alphanumeric characters except hyphen, space, dot,and parentheses with an empty string- return inputString?.replace(/[^a-zA-Z0-9\s.()-]/g, "");+ // Keep only characters that are valid for S3 keys+ return inputString?.replace(/[^a-zA-Z0-9\/!_\-.*'() &$@=;:+,?]/g, "");}export const snakeToCamel = (str: string) =>diff --git a/apps/mes/app/routes/file+/preview+/image.tsx b/apps/mes/app/routes/file+/preview+/image.tsxindex fd5ea5ba92..2b20b19023 100644--- a/apps/mes/app/routes/file+/preview+/image.tsx+++ b/apps/mes/app/routes/file+/preview+/image.tsx@@ -31,7 +31,7 @@ export let loader = async ({ request }: LoaderFunctionArgs) => {</style></head><body>- <img src=${path.to.file.previewFile(file)} />+ <img src="${path.to.file.previewFile(file)}" /></body></html>`;const headers = new Headers({ "Content-Type": "text/html" });