From: Michael Tremer Date: Tue, 8 Jul 2025 09:15:39 +0000 (+0000) Subject: frontend: Only offer files for download that are downloadable X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69c7f844c7e5eff67e0b85b1b593c25fdaa2a2f6;p=pbs.git frontend: Only offer files for download that are downloadable Signed-off-by: Michael Tremer --- 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; +}