Skip to content

Commit

Permalink
fix: display file size as base 2 (KiB instead of KB) (#2779)
Browse files Browse the repository at this point in the history
  • Loading branch information
kloon15 committed Nov 2, 2023
1 parent d0c3aea commit cdcd9a3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/files/ListingItem.vue
Expand Up @@ -37,7 +37,7 @@
<script>
import { enableThumbs } from "@/utils/constants";
import { mapMutations, mapGetters, mapState } from "vuex";
import { filesize } from "filesize";
import { filesize } from "@/utils";
import moment from "moment";
import { files as api } from "@/api";
import * as upload from "@/utils/upload";
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/prompts/Info.vue
Expand Up @@ -81,7 +81,7 @@

<script>
import { mapState, mapGetters } from "vuex";
import { filesize } from "filesize";
import { filesize } from "@/utils";
import moment from "moment";
import { files as api } from "@/api";
Expand Down Expand Up @@ -142,7 +142,7 @@ export default {
try {
const hash = await api.checksum(link, algo);
// eslint-disable-next-line
event.target.innerHTML = hash
event.target.innerHTML = hash;
} catch (e) {
this.$showError(e);
}
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/utils/index.js
@@ -0,0 +1,6 @@
import { partial } from "filesize";

/**
* Formats filesize as KiB/MiB/...
*/
export const filesize = partial({ base: 2 });
2 changes: 1 addition & 1 deletion frontend/src/views/Share.vue
Expand Up @@ -182,7 +182,7 @@
<script>
import { mapState, mapMutations, mapGetters } from "vuex";
import { pub as api } from "@/api";
import { filesize } from "filesize";
import { filesize } from "@/utils";
import moment from "moment";
import HeaderBar from "@/components/header/HeaderBar.vue";
Expand Down

0 comments on commit cdcd9a3

Please sign in to comment.