From 69c7f844c7e5eff67e0b85b1b593c25fdaa2a2f6 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 8 Jul 2025 09:15:39 +0000 Subject: [PATCH] frontend: Only offer files for download that are downloadable Signed-off-by: Michael Tremer --- frontend/src/components/PackageFilelist.vue | 3 ++- frontend/src/utils/files.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 frontend/src/utils/files.ts diff --git a/frontend/src/components/PackageFilelist.vue b/frontend/src/components/PackageFilelist.vue index 934cbcaf..6893ec26 100644 --- a/frontend/src/components/PackageFilelist.vue +++ b/frontend/src/components/PackageFilelist.vue @@ -12,6 +12,7 @@ import Section from "@/components/Section.vue"; // Utils + import { fileIsDownloadable } from "@/utils/files"; import { formatMode, formatSize } from "@/utils/format"; // Fetch the package @@ -97,7 +98,7 @@
- diff --git a/frontend/src/utils/files.ts b/frontend/src/utils/files.ts new file mode 100644 index 00000000..c90c6fca --- /dev/null +++ b/frontend/src/utils/files.ts @@ -0,0 +1,11 @@ +import type { File } from "@/api/packages"; + +/* + Helper functions for files +*/ +export function fileIsDownloadable(file: File): Boolean { + const S_IFMT = 0o170000; + const S_IFREG = 0o100000; + + return (file.mode & S_IFMT) === S_IFREG; +} -- 2.47.2