From 3a3c305e30446963d2290489ef318e5ee5e828b7 Mon Sep 17 00:00:00 2001 From: Raitis Veinbahs Date: Fri, 11 Oct 2024 12:29:21 +0300 Subject: [PATCH] feat: Allow uploading JSON text files (DEV-4222) (#3386) --- docs/01-introduction/file-formats.md | 2 +- docs/03-endpoints/api-v2/editing-values.md | 2 +- sipi/scripts/file_info.lua | 3 ++- webapi/src/main/resources/application.conf | 9 +++++---- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/01-introduction/file-formats.md b/docs/01-introduction/file-formats.md index d1b159802f..a0b60f0e8a 100644 --- a/docs/01-introduction/file-formats.md +++ b/docs/01-introduction/file-formats.md @@ -14,7 +14,7 @@ The following table shows the accepted file formats: | Category | Accepted format | Converted during ingest? | | --------------------- | -------------------------------------- | -------------------------------------------------------------------------- | -| Text, XML *) | ODD, RNG, TXT, XML, XSD, XSL | No | +| Text, XML *) | JSON, ODD, RNG, TXT, XML, XSD, XSL | No | | Tables | CSV, XLS, XLSX | No | | 2D Images | JPG, JPEG, JP2, PNG, TIF, TIFF | Yes, converted to JPEG 2000 by [Sipi](https://github.com/dasch-swiss/sipi) | | Audio | MPEG (MP3), WAV | No | diff --git a/docs/03-endpoints/api-v2/editing-values.md b/docs/03-endpoints/api-v2/editing-values.md index 83287faace..4b13283203 100644 --- a/docs/03-endpoints/api-v2/editing-values.md +++ b/docs/03-endpoints/api-v2/editing-values.md @@ -244,7 +244,7 @@ the following types of files: - Images: JPEG, JPEG2000, TIFF, or PNG which are stored internally as JPEG2000 - Documents: PDF - Audio: MPEG or Waveform audio file format (.wav, .x-wav, .vnd.wave) -- Text files: CSV, ODD, RNG, TXT, XLS, XLSX, XML, XSD, XSL +- Text files: CSV, JSON, ODD, RNG, TXT, XLS, XLSX, XML, XSD, XSL - Video files: MP4 - Archive files: ZIP, TAR, GZIP diff --git a/sipi/scripts/file_info.lua b/sipi/scripts/file_info.lua index feb2c4691d..9a25ab3c87 100644 --- a/sipi/scripts/file_info.lua +++ b/sipi/scripts/file_info.lua @@ -101,12 +101,13 @@ local audio_extensions = { local text_extensions = { "csv", + "json", "odd", "rng", "txt", "xml", "xsd", - "xsl" + "xsl", } local document_extensions = { diff --git a/webapi/src/main/resources/application.conf b/webapi/src/main/resources/application.conf index ba98ea244a..494d26f391 100644 --- a/webapi/src/main/resources/application.conf +++ b/webapi/src/main/resources/application.conf @@ -331,14 +331,15 @@ app { "application/vnd.openxmlformats-officedocument.presentationml.presentation", ] text-mime-types = [ - "application/xml", + "application/json", "application/odd+xml", "application/rng+xml", + "application/xml", "application/xsd+xml", "application/xslt+xml", - "text/xml", "text/csv", - "text/plain" + "text/plain", + "text/xml", ] video-mime-types = ["video/mp4"] audio-mime-types = ["audio/mpeg", "audio/wav", "audio/x-wav", "audio/vnd.wave"] @@ -347,7 +348,7 @@ app { "application/x-tar", "application/gzip", "application/x-7z-compressed", - "application/x-compress" + "application/x-compress", ] }