fix: display file size as base 2 (KiB instead of KB) (#2779)

pull/2749/head
kloon15 2023-11-02 08:47:55 +01:00 committed by GitHub
parent d0c3aeace1
commit cdcd9a313a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 4 deletions

View File

@ -37,7 +37,7 @@
<script> <script>
import { enableThumbs } from "@/utils/constants"; import { enableThumbs } from "@/utils/constants";
import { mapMutations, mapGetters, mapState } from "vuex"; import { mapMutations, mapGetters, mapState } from "vuex";
import { filesize } from "filesize"; import { filesize } from "@/utils";
import moment from "moment"; import moment from "moment";
import { files as api } from "@/api"; import { files as api } from "@/api";
import * as upload from "@/utils/upload"; import * as upload from "@/utils/upload";

View File

@ -81,7 +81,7 @@
<script> <script>
import { mapState, mapGetters } from "vuex"; import { mapState, mapGetters } from "vuex";
import { filesize } from "filesize"; import { filesize } from "@/utils";
import moment from "moment"; import moment from "moment";
import { files as api } from "@/api"; import { files as api } from "@/api";
@ -142,7 +142,7 @@ export default {
try { try {
const hash = await api.checksum(link, algo); const hash = await api.checksum(link, algo);
// eslint-disable-next-line // eslint-disable-next-line
event.target.innerHTML = hash event.target.innerHTML = hash;
} catch (e) { } catch (e) {
this.$showError(e); this.$showError(e);
} }

View File

@ -0,0 +1,6 @@
import { partial } from "filesize";
/**
* Formats filesize as KiB/MiB/...
*/
export const filesize = partial({ base: 2 });

View File

@ -182,7 +182,7 @@
<script> <script>
import { mapState, mapMutations, mapGetters } from "vuex"; import { mapState, mapMutations, mapGetters } from "vuex";
import { pub as api } from "@/api"; import { pub as api } from "@/api";
import { filesize } from "filesize"; import { filesize } from "@/utils";
import moment from "moment"; import moment from "moment";
import HeaderBar from "@/components/header/HeaderBar.vue"; import HeaderBar from "@/components/header/HeaderBar.vue";