Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
import Section from "@/components/Section.vue";
// Utils
+ import { fileIsDownloadable } from "@/utils/files";
import { formatMode, formatSize } from "@/utils/format";
// Fetch the package
<!-- Actions -->
<td class="is-narrow">
<div class="buttons are-small">
- <a class="button is-dark"
+ <a class="button is-dark" v-if="fileIsDownloadable(file)"
download :href="`/packages/${pkg.uuid}/download${file.path}`">
<Icon icon="download" :title="$t('Download')" />
</a>
--- /dev/null
+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;
+}