Skip to content

Commit 8a70359

Browse files
committed
fix: sanitize file display paths in SubmissionUploadForm
1 parent 91d3098 commit 8a70359

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/submissions/submission-upload-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export default function SubmissionUploadForm({ problemId, uploadLimits }: Submis
275275
<h4 className="font-semibold">Selected files:</h4>
276276
<ul className="space-y-1 bg-muted p-3 rounded-md max-h-48 overflow-y-auto">
277277
{files.map((file, index) => {
278-
const displayPath = (file as FileWithPath).path || (file as any).webkitRelativePath || file.name;
278+
const displayPath = ((file as FileWithPath).path || (file as any).webkitRelativePath || file.name).replace(/^\/+/, "").replace(/^(\.\/)+/, "");
279279
return (
280280
<li key={`${displayPath}-${index}`} className="flex items-center justify-between text-sm">
281281
<span className="flex items-center gap-2 truncate">

0 commit comments

Comments
 (0)