Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
This gitlab instance will be under maintenance Tuesday 6th May from 10 am to 11 am CET
Show more breadcrumbs
Arkindex
Frontend
Commits
1e49fad7
Commit
1e49fad7
authored
1 year ago
by
Erwan Rouchet
Committed by
Bastien Abadie
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Allow all archive formats
parent
b3d51179
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1599
Allow all archive formats
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/config.ts
+28
-0
28 additions, 0 deletions
src/config.ts
src/views/Imports/ImportFromFiles.vue
+7
-6
7 additions, 6 deletions
src/views/Imports/ImportFromFiles.vue
with
35 additions
and
6 deletions
src/config.ts
+
28
−
0
View file @
1e49fad7
...
...
@@ -456,3 +456,31 @@ export const ROLES: { readonly [name: string]: Role } = {
export
const
BANNER_MESSAGE
=
metas
.
banner_message
export
const
BANNER_STYLE
=
metas
.
banner_style
in
NOTIFICATION_TYPES
?
metas
.
banner_style
:
'
info
'
/**
* MIME types of supported archives in file imports
*/
export
const
ARCHIVE_MIME_TYPES
=
[
// .zip, standard
'
application/zip
'
,
// .zip, from Windows only
'
application/x-zip-compressed
'
,
// .tar
'
application/x-tar
'
,
// .tar.gz, from libmagic only
'
application/x-gtar
'
,
// .tgz, from browsers only
'
application/x-compressed-tar
'
,
// .gz from anywhere, .tgz from libmagic only
'
application/gzip
'
,
// .bz2, from browsers only
'
application/x-bzip
'
,
// .bz2, from libmagic only
'
application/x-bzip2
'
,
// .lzma
'
application/x-lzma
'
,
// .xz
'
application/x-xz
'
,
// .zst
'
application/zstd
'
]
This diff is collapsed.
Click to expand it.
src/views/Imports/ImportFromFiles.vue
+
7
−
6
View file @
1e49fad7
...
...
@@ -126,12 +126,13 @@
</template>
<
script
>
import
{
isAxiosError
}
from
'
axios
'
import
{
mapGetters
as
mapVuexGetters
}
from
'
vuex
'
import
{
mapState
,
mapActions
}
from
'
pinia
'
import
FileSelector
from
'
@/components/Imports/Files/Selector
'
import
{
truncateMixin
,
corporaMixin
}
from
'
@/mixins.js
'
import
{
isAxiosError
}
from
'
axios
'
import
{
ARCHIVE_MIME_TYPES
}
from
'
@/config
'
import
{
truncateMixin
,
corporaMixin
}
from
'
@/mixins
'
import
{
useNotificationStore
,
usePonosStore
}
from
'
@/stores
'
import
FileSelector
from
'
@/components/Imports/Files/Selector
'
export
default
{
mixins
:
[
...
...
@@ -245,12 +246,12 @@ export default {
const
pdfCount
=
this
.
selectedFiles
.
filter
(
file
=>
file
.
content_type
===
'
application/pdf
'
).
length
const
imgCount
=
this
.
selectedFiles
.
filter
(
file
=>
file
.
content_type
.
startsWith
(
'
image/
'
)).
length
const
zip
Count
=
this
.
selectedFiles
.
filter
(
file
=>
[
'
application/zip
'
,
'
application/x-zip-compressed
'
]
.
includes
(
file
.
content_type
)).
length
const
filesCount
=
pdfCount
+
imgCount
+
zip
Count
const
archive
Count
=
this
.
selectedFiles
.
filter
(
file
=>
ARCHIVE_MIME_TYPES
.
includes
(
file
.
content_type
)).
length
const
filesCount
=
pdfCount
+
imgCount
+
archive
Count
const
iiifCount
=
this
.
selectedFiles
.
filter
(
file
=>
[
'
application/ld+json
'
,
'
application/json
'
].
includes
(
file
.
content_type
.
split
(
'
;
'
)[
0
])).
length
if
(
filesCount
+
iiifCount
<
this
.
selectedFiles
.
length
)
{
this
.
selectionError
=
'
Can only import images, PDF documents,
ZIP
archives or IIIF files
'
this
.
selectionError
=
'
Can only import images, PDF documents, archives or IIIF files
'
return
}
if
(
filesCount
&&
iiifCount
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment