From f6af2f42ad901abf8e761276361aec878d6507b4 Mon Sep 17 00:00:00 2001 From: Louie Torres <30176969+louie-github@users.noreply.github.com> Date: Thu, 12 Jan 2023 00:25:34 +0800 Subject: [PATCH] feat: extended jxl support --- Cargo.lock | 4 +- .../components/BrowserContentHandler.sys.mjs | 1 + .../windows/msix/AppxManifest.xml.in | 1 + browser/installer/windows/nsis/shared.nsh | 1 + .../installer/windows/nsis/uninstaller.nsi | 2 + image/DecoderFactory.cpp | 6 +- image/decoders/nsJXLDecoder.cpp | 250 +- image/decoders/nsJXLDecoder.h | 14 +- supply-chain/imports.lock | 6 + .../rust/mime_guess/.cargo-checksum.json | 2 +- third_party/rust/mime_guess/Cargo.lock | 401 +-- third_party/rust/mime_guess/Cargo.toml | 11 +- third_party/rust/mime_guess/LICENSE | 44 +- third_party/rust/mime_guess/README.md | 172 +- .../rust/mime_guess/benches/benchmark.rs | 62 +- third_party/rust/mime_guess/build.rs | 387 +-- .../rust/mime_guess/examples/rev_map.rs | 28 +- .../rust/mime_guess/src/impl_bin_search.rs | 82 +- third_party/rust/mime_guess/src/impl_phf.rs | 80 +- third_party/rust/mime_guess/src/lib.rs | 1068 +++--- third_party/rust/mime_guess/src/mime_types.rs | 3033 +++++++++-------- .../components/downloads/DownloadList.sys.mjs | 1 + .../extensions/parent/ext-downloads.js | 1 + toolkit/content/filepicker.properties | 2 +- toolkit/moz.configure | 6 +- widget/gtk/nsAppShell.cpp | 3 +- 26 files changed, 2982 insertions(+), 2686 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b3e9b9472a80..b70062a76f2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4082,9 +4082,9 @@ dependencies = [ [[package]] name = "mime_guess" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" dependencies = [ "mime", "unicase", diff --git a/browser/components/BrowserContentHandler.sys.mjs b/browser/components/BrowserContentHandler.sys.mjs index f10ea22700ab..2a2e6b677741 100644 --- a/browser/components/BrowserContentHandler.sys.mjs +++ b/browser/components/BrowserContentHandler.sys.mjs @@ -1288,6 +1288,7 @@ function maybeRecordToHandleTelemetry(uri, isLaunch) { ".xhtml", ".svg", ".webp", + ".jxl", ]); if (registeredExtensions.has(extension)) { counter[extension].add(1); diff --git a/browser/installer/windows/msix/AppxManifest.xml.in b/browser/installer/windows/msix/AppxManifest.xml.in index b81a73518a18..56a62dcca191 100644 --- a/browser/installer/windows/msix/AppxManifest.xml.in +++ b/browser/installer/windows/msix/AppxManifest.xml.in @@ -67,6 +67,7 @@ .xhtml .svg .webp + .jxl Assets\Document44x44.png diff --git a/browser/installer/windows/nsis/shared.nsh b/browser/installer/windows/nsis/shared.nsh index c75f2d3b60dd..cf50cf017af5 100755 --- a/browser/installer/windows/nsis/shared.nsh +++ b/browser/installer/windows/nsis/shared.nsh @@ -513,6 +513,7 @@ ${RemoveDefaultBrowserAgentShortcut} ${AddAssociationIfNoneExist} ".svg" "WaterfoxHTML$5" ${AddAssociationIfNoneExist} ".webp" "WaterfoxHTML$5" ${AddAssociationIfNoneExist} ".avif" "WaterfoxHTML$5" + ${AddAssociationIfNoneExist} ".jxl" "WaterfoxHTML$5" ${AddAssociationIfNoneExist} ".pdf" "WaterfoxPDF$5" diff --git a/browser/installer/windows/nsis/uninstaller.nsi b/browser/installer/windows/nsis/uninstaller.nsi index 33968e59d011..26bca4ec8274 100755 --- a/browser/installer/windows/nsis/uninstaller.nsi +++ b/browser/installer/windows/nsis/uninstaller.nsi @@ -505,7 +505,9 @@ Section "Uninstall" ${un.RegCleanFileHandler} ".ogv" "WaterfoxHTML-$AppUserModelID" ${un.RegCleanFileHandler} ".webm" "WaterfoxHTML-$AppUserModelID" ${un.RegCleanFileHandler} ".svg" "WaterfoxHTML-$AppUserModelID" + ${un.RegCleanFileHandler} ".webp" "WaterfoxHTML-$AppUserModelID" ${un.RegCleanFileHandler} ".avif" "WaterfoxHTML-$AppUserModelID" + ${un.RegCleanFileHandler} ".jxl" "WaterfoxHTML-$AppUserModelID" ${un.RegCleanFileHandler} ".pdf" "WaterfoxPDF-$AppUserModelID" diff --git a/image/DecoderFactory.cpp b/image/DecoderFactory.cpp index 21c94898cbbc..df0ee35cbf29 100644 --- a/image/DecoderFactory.cpp +++ b/image/DecoderFactory.cpp @@ -249,7 +249,8 @@ nsresult DecoderFactory::CreateAnimationDecoder( } MOZ_ASSERT(aType == DecoderType::GIF || aType == DecoderType::PNG || - aType == DecoderType::WEBP || aType == DecoderType::AVIF, + aType == DecoderType::WEBP || aType == DecoderType::AVIF || + aType == DecoderType::JXL, "Calling CreateAnimationDecoder for non-animating DecoderType"); // Create an anonymous decoder. Interaction with the SurfaceCache and the @@ -304,7 +305,8 @@ already_AddRefed DecoderFactory::CloneAnimationDecoder( // rediscover it is animated). DecoderType type = aDecoder->GetType(); MOZ_ASSERT(type == DecoderType::GIF || type == DecoderType::PNG || - type == DecoderType::WEBP || type == DecoderType::AVIF, + type == DecoderType::WEBP || type == DecoderType::AVIF || + type == DecoderType::JXL, "Calling CloneAnimationDecoder for non-animating DecoderType"); RefPtr decoder = GetDecoder(type, nullptr, /* aIsRedecode = */ true); diff --git a/image/decoders/nsJXLDecoder.cpp b/image/decoders/nsJXLDecoder.cpp index ffb7f3cd51e1..98a8227a65ab 100644 --- a/image/decoders/nsJXLDecoder.cpp +++ b/image/decoders/nsJXLDecoder.cpp @@ -45,9 +45,20 @@ nsJXLDecoder::nsJXLDecoder(RasterImage* aImage) Transition::TerminateSuccess()), mDecoder(JxlDecoderMake(nullptr)), mParallelRunner( - JxlThreadParallelRunnerMake(nullptr, PreferredThreadCount())) { - JxlDecoderSubscribeEvents(mDecoder.get(), - JXL_DEC_BASIC_INFO | JXL_DEC_FULL_IMAGE); + JxlThreadParallelRunnerMake(nullptr, PreferredThreadCount())), + mUsePipeTransform(true), + mCMSLine(nullptr), + mNumFrames(0), + mTimeout(FrameTimeout::Forever()), + mSurfaceFormat(SurfaceFormat::OS_RGBX), + mContinue(false) { + int events = JXL_DEC_BASIC_INFO | JXL_DEC_FRAME | JXL_DEC_FULL_IMAGE; + + if (mCMSMode != CMSMode::Off) { + events |= JXL_DEC_COLOR_ENCODING; + } + + JxlDecoderSubscribeEvents(mDecoder.get(), events); JxlDecoderSetParallelRunner(mDecoder.get(), JxlThreadParallelRunner, mParallelRunner.get()); @@ -58,6 +69,10 @@ nsJXLDecoder::nsJXLDecoder(RasterImage* aImage) nsJXLDecoder::~nsJXLDecoder() { MOZ_LOG(sJXLLog, LogLevel::Debug, ("[this=%p] nsJXLDecoder::~nsJXLDecoder", this)); + + if (mCMSLine) { + free(mCMSLine); + } } size_t nsJXLDecoder::PreferredThreadCount() { @@ -86,14 +101,20 @@ LexerResult nsJXLDecoder::DoDecode(SourceBufferIterator& aIterator, LexerTransition nsJXLDecoder::ReadJXLData( const char* aData, size_t aLength) { - const uint8_t* input = (const uint8_t*)aData; - size_t length = aLength; - if (mBuffer.length() != 0) { - JXL_TRY_BOOL(mBuffer.append(aData, aLength)); - input = mBuffer.begin(); - length = mBuffer.length(); + // Ignore data we have already read. + // This will only occur as a result of a yield for animation. + if (!mContinue) { + const uint8_t* input = (const uint8_t*)aData; + size_t length = aLength; + if (mBuffer.length() != 0) { + JXL_TRY_BOOL(mBuffer.append(aData, aLength)); + input = mBuffer.begin(); + length = mBuffer.length(); + } + + JXL_TRY(JxlDecoderSetInput(mDecoder.get(), input, length)); } - JXL_TRY(JxlDecoderSetInput(mDecoder.get(), input, length)); + mContinue = false; while (true) { JxlDecoderStatus status = JxlDecoderProcessInput(mDecoder.get()); @@ -106,6 +127,34 @@ LexerTransition nsJXLDecoder::ReadJXLData( size_t remaining = JxlDecoderReleaseInput(mDecoder.get()); mBuffer.clear(); JXL_TRY_BOOL(mBuffer.append(aData + aLength - remaining, remaining)); + + if (mNumFrames == 0 && InFrame()) { + // If an image was flushed by JxlDecoderFlushImage, then we know that + // JXL_DEC_FRAME has already been run and there is a pipe. + if (JxlDecoderFlushImage(mDecoder.get()) == JXL_DEC_SUCCESS) { + // A full frame partial image is written to the buffer. + mPipe.ResetToFirstRow(); + for (uint8_t* rowPtr = mOutBuffer.begin(); + rowPtr < mOutBuffer.end(); rowPtr += mInfo.xsize * mChannels) { + uint8_t* rowToWrite = rowPtr; + + if (!mUsePipeTransform && mTransform) { + qcms_transform_data(mTransform, rowToWrite, mCMSLine, + mInfo.xsize); + rowToWrite = mCMSLine; + } + + mPipe.WriteBuffer(reinterpret_cast(rowToWrite)); + } + + if (Maybe invalidRect = + mPipe.TakeInvalidRect()) { + PostInvalidation(invalidRect->mInputSpaceRect, + Some(invalidRect->mOutputSpaceRect)); + } + } + } + return Transition::ContinueUnbuffered(State::JXL_DATA); } @@ -116,42 +165,199 @@ LexerTransition nsJXLDecoder::ReadJXLData( PostFrameCount(/* aFrameCount */ 1); } if (mInfo.alpha_bits > 0) { + mSurfaceFormat = SurfaceFormat::OS_RGBA; PostHasTransparency(); } + + if (!mInfo.have_animation && IsMetadataDecode()) { + return Transition::TerminateSuccess(); + } + + // If CMS is off or the image is RGB, always output in RGBA. + // If the image is grayscale, then the pipe transform can't be used. + if (mCMSMode != CMSMode::Off) { + mChannels = mInfo.num_color_channels == 1 + ? 1 + (mInfo.alpha_bits > 0 ? 1 : 0) + : 4; + } else { + mChannels = 4; + } + + mFormat = {mChannels, JXL_TYPE_UINT8, JXL_LITTLE_ENDIAN, 0}; + + break; + } + + case JXL_DEC_COLOR_ENCODING: { + size_t size = 0; + JXL_TRY(JxlDecoderGetICCProfileSize( + mDecoder.get(), JXL_COLOR_PROFILE_TARGET_DATA, &size)) + std::vector icc_profile(size); + JXL_TRY(JxlDecoderGetColorAsICCProfile(mDecoder.get(), + JXL_COLOR_PROFILE_TARGET_DATA, + icc_profile.data(), size)) + + mInProfile = qcms_profile_from_memory((char*)icc_profile.data(), size); + + uint32_t profileSpace = qcms_profile_get_color_space(mInProfile); + + // Skip color management if color profile is not compatible with number + // of channels. + if (profileSpace != icSigRgbData && + (mInfo.num_color_channels == 3 || profileSpace != icSigGrayData)) { + break; + } + + mUsePipeTransform = + profileSpace == icSigRgbData && mInfo.num_color_channels == 3; + + qcms_data_type inType; + if (mInfo.num_color_channels == 3) { + inType = QCMS_DATA_RGBA_8; + } else if (mInfo.alpha_bits > 0) { + inType = QCMS_DATA_GRAYA_8; + } else { + inType = QCMS_DATA_GRAY_8; + } + + if (!mUsePipeTransform) { + mCMSLine = + static_cast(malloc(sizeof(uint32_t) * mInfo.xsize)); + } + + int intent = gfxPlatform::GetRenderingIntent(); + if (intent == -1) { + intent = qcms_profile_get_rendering_intent(mInProfile); + } + + mTransform = + qcms_transform_create(mInProfile, inType, GetCMSOutputProfile(), + QCMS_DATA_RGBA_8, (qcms_intent)intent); + + break; + } + + case JXL_DEC_FRAME: { + if (mInfo.have_animation) { + JXL_TRY(JxlDecoderGetFrameHeader(mDecoder.get(), &mFrameHeader)); + int32_t duration = (int32_t)(1000.0 * mFrameHeader.duration * + mInfo.animation.tps_denominator / + mInfo.animation.tps_numerator); + + mTimeout = FrameTimeout::FromRawMilliseconds(duration); + + if (!HasAnimation()) { + PostIsAnimated(mTimeout); + } + } + + bool is_last = mInfo.have_animation ? mFrameHeader.is_last : true; + MOZ_LOG(sJXLLog, LogLevel::Debug, + ("[this=%p] nsJXLDecoder::ReadJXLData - frame %d, is_last %d, " + "metadata decode %d, first frame decode %d\n", + this, mNumFrames, is_last, IsMetadataDecode(), + IsFirstFrameDecode())); + if (IsMetadataDecode()) { return Transition::TerminateSuccess(); } + + OrientedIntSize size(mInfo.xsize, mInfo.ysize); + + Maybe animParams; + if (!IsFirstFrameDecode()) { + animParams.emplace(FullFrame().ToUnknownRect(), mTimeout, mNumFrames, + BlendMethod::SOURCE, DisposalMethod::CLEAR); + } + + SurfacePipeFlags pipeFlags = SurfacePipeFlags(); + + if (mNumFrames == 0) { + // The first frame may be displayed progressively. + pipeFlags |= SurfacePipeFlags::PROGRESSIVE_DISPLAY; + } + + if (mSurfaceFormat == SurfaceFormat::OS_RGBA && + !(GetSurfaceFlags() & SurfaceFlags::NO_PREMULTIPLY_ALPHA)) { + pipeFlags |= SurfacePipeFlags::PREMULTIPLY_ALPHA; + } + + qcms_transform* pipeTransform = + mUsePipeTransform ? mTransform : nullptr; + + Maybe pipe = SurfacePipeFactory::CreateSurfacePipe( + this, size, OutputSize(), FullFrame(), SurfaceFormat::R8G8B8A8, + mSurfaceFormat, animParams, pipeTransform, pipeFlags); + + if (!pipe) { + MOZ_LOG(sJXLLog, LogLevel::Debug, + ("[this=%p] nsJXLDecoder::ReadJXLData - no pipe\n", this)); + return Transition::TerminateFailure(); + } + + mPipe = std::move(*pipe); + break; } case JXL_DEC_NEED_IMAGE_OUT_BUFFER: { size_t size = 0; - JxlPixelFormat format{4, JXL_TYPE_UINT8, JXL_LITTLE_ENDIAN, 0}; - JXL_TRY(JxlDecoderImageOutBufferSize(mDecoder.get(), &format, &size)); + JXL_TRY(JxlDecoderImageOutBufferSize(mDecoder.get(), &mFormat, &size)); mOutBuffer.clear(); JXL_TRY_BOOL(mOutBuffer.growBy(size)); - JXL_TRY(JxlDecoderSetImageOutBuffer(mDecoder.get(), &format, + JXL_TRY(JxlDecoderSetImageOutBuffer(mDecoder.get(), &mFormat, mOutBuffer.begin(), size)); break; } case JXL_DEC_FULL_IMAGE: { - OrientedIntSize size(mInfo.xsize, mInfo.ysize); - Maybe pipe = SurfacePipeFactory::CreateSurfacePipe( - this, size, OutputSize(), FullFrame(), SurfaceFormat::R8G8B8A8, - SurfaceFormat::OS_RGBA, Nothing(), nullptr, SurfacePipeFlags()); + mPipe.ResetToFirstRow(); for (uint8_t* rowPtr = mOutBuffer.begin(); rowPtr < mOutBuffer.end(); - rowPtr += mInfo.xsize * 4) { - pipe->WriteBuffer(reinterpret_cast(rowPtr)); + rowPtr += mInfo.xsize * mChannels) { + uint8_t* rowToWrite = rowPtr; + + if (!mUsePipeTransform && mTransform) { + qcms_transform_data(mTransform, rowToWrite, mCMSLine, mInfo.xsize); + rowToWrite = mCMSLine; + } + + mPipe.WriteBuffer(reinterpret_cast(rowToWrite)); } - if (Maybe invalidRect = pipe->TakeInvalidRect()) { + if (Maybe invalidRect = mPipe.TakeInvalidRect()) { PostInvalidation(invalidRect->mInputSpaceRect, Some(invalidRect->mOutputSpaceRect)); } - PostFrameStop(); - PostDecodeDone(); + + Opacity opacity = mSurfaceFormat == SurfaceFormat::OS_RGBA + ? Opacity::SOME_TRANSPARENCY + : Opacity::FULLY_OPAQUE; + PostFrameStop(opacity); + + if (!IsFirstFrameDecode() && mInfo.have_animation && + !mFrameHeader.is_last) { + mNumFrames++; + mContinue = true; + // Notify for a new frame but there may be data in the current buffer + // that can immediately be processed. + return Transition::ToAfterYield(State::JXL_DATA); + } + [[fallthrough]]; // We are done. + } + + case JXL_DEC_SUCCESS: { + int32_t loopArg; + if (HasAnimation()) { + // JXL num_loops: 0 means infinite. (num_loops - 1) becomes -1. + // JXL num_loops: 1 means play once. (num_loops - 1) becomes 0 (0 repeats). + // JXL num_loops: N means play N times. (num_loops - 1) becomes N-1 (N-1 repeats). + loopArg = static_cast(mInfo.animation.num_loops) - 1; + } else { + loopArg = 0; // For non-animated images, repeat count is 0. + } + PostLoopCount(loopArg); // Pass the loop count to PostLoopCount + PostDecodeDone(); // Call PostDecodeDone without arguments return Transition::TerminateSuccess(); } } diff --git a/image/decoders/nsJXLDecoder.h b/image/decoders/nsJXLDecoder.h index 0b723878aefd..a83a74915557 100644 --- a/image/decoders/nsJXLDecoder.h +++ b/image/decoders/nsJXLDecoder.h @@ -45,7 +45,19 @@ class nsJXLDecoder final : public Decoder { JxlThreadParallelRunnerPtr mParallelRunner; Vector mBuffer; Vector mOutBuffer; - JxlBasicInfo mInfo{}; + JxlBasicInfo mInfo; + JxlPixelFormat mFormat; + JxlFrameHeader mFrameHeader; + + bool mUsePipeTransform; + uint8_t mChannels; + uint8_t* mCMSLine; + + uint32_t mNumFrames; + FrameTimeout mTimeout; + gfx::SurfaceFormat mSurfaceFormat; + SurfacePipe mPipe; + bool mContinue; }; } // namespace mozilla::image diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index 4cf34b18c171..4a4a3c6a4fec 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -2347,6 +2347,12 @@ version = "1.4.0" notes = "I have read over the macros, and audited the unsafe code." aggregated-from = "https://raw.githubusercontent.com/mozilla/cargo-vet/main/supply-chain/audits.toml" +[[audits.mozilla.audits.mime_guess]] +who = "Jan-Erik Rediger " +criteria = "safe-to-deploy" +delta = "2.0.4 -> 2.0.5" +aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml" + [[audits.mozilla.audits.rkv]] who = "Kagami Sascha Rosylight " criteria = "safe-to-deploy" diff --git a/third_party/rust/mime_guess/.cargo-checksum.json b/third_party/rust/mime_guess/.cargo-checksum.json index a1d0edbcf3b7..9af6043ca148 100644 --- a/third_party/rust/mime_guess/.cargo-checksum.json +++ b/third_party/rust/mime_guess/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.lock":"1be3b2e0b56466b1a4ab94c35176df5a41846677caa7bd2d5603cfdb19d9eef3","Cargo.toml":"c367dbd734e16d3dc6333fc072021372baee73170ec1c9b19606bb52f1772d9a","LICENSE":"6919f1acec82afc721be2d9907b993267f433a44d25d8aedf1003b5f59ebfd46","README.md":"417338ebb9da8e8bdfad3c3da81248ab5f023652f3468ec5dcb2fdf43ea40b32","benches/benchmark.rs":"2287c7233cf78a9af98b2b53cd20e221e4a785209bd70a87030f1ade34a02507","build.rs":"8e47254c0a927eeb243058cfc0da413f34a958226707c941e8634e4514562f04","examples/rev_map.rs":"0bab6cc20b9eace741c6cc4a8c67ebfa124df1bf213038c5e34976081ffd2ebc","src/impl_bin_search.rs":"32a89409690d57f074f11eb93a9d6e422f73788af63fc29f980e13d1c2d2fa6f","src/impl_phf.rs":"321028cc657364c6f7c5b5f538b0033bcfd6f3b5ef711304d806c0644466a964","src/lib.rs":"bb190bcbbf4139c410af20564f0376a99a83474ca12b7e8c6860228e0caff7da","src/mime_types.rs":"57ee8db84eb0fc4f06a3eac0da8c730a334cb99a7e81e60413f5febd886d91f4"},"package":"4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef"} \ No newline at end of file +{"files":{"Cargo.lock":"2b59f34ab30d336b54edb66ea861174599310a5a87d597f45ca518cf55a186dc","Cargo.toml":"aca17af6f0fd2497700e94f764a25862ea41a35629fe4ba6603596213b8e1d88","LICENSE":"816000f9c28f7005d931c77636eb79fa7020071eb0f6e6a995515dfccd3559cb","README.md":"32663b3f4530e71cfec689576cca62911c83e504232963c65da82ebed26e2aa7","benches/benchmark.rs":"021dde9d834a3e4fab08d41f6e23d4f083f18c5f382b59866c2e07dc0ed9747a","build.rs":"bc413487e376b343b65089a9a897f4bb3c9d5fbaa5a6833e87db1d3c18c462d8","examples/rev_map.rs":"13a79d0b9eba6bfb49f99102917d1dada89c37ffcfab492759af997539b616ba","src/impl_bin_search.rs":"dd5817c9bc817c36274361c4cd0612ed303347c38bdbf8dff84cf57cd2918808","src/impl_phf.rs":"a9d956119304926c1f37754102ff74fbfe36004e24e326329e67e7c51fff381b","src/lib.rs":"7ea3571f3b7a231e4bf0003d66056becddeedb3084ee7af7fa9826f0602613f4","src/mime_types.rs":"1e89c58024547606d78e71488f0e027b740613fc22ac5877e24e3851e0f0628b"},"package":"f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"} \ No newline at end of file diff --git a/third_party/rust/mime_guess/Cargo.lock b/third_party/rust/mime_guess/Cargo.lock index 18dfe39b8c08..aedfa966a1c0 100644 --- a/third_party/rust/mime_guess/Cargo.lock +++ b/third_party/rust/mime_guess/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "atty" version = "0.2.14" @@ -15,42 +24,27 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "bstr" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279" -dependencies = [ - "lazy_static", - "memchr", - "regex-automata", - "serde", -] +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bumpalo" -version = "3.7.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "cast" -version = "0.2.7" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a" -dependencies = [ - "rustc_version", -] +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cfg-if" @@ -60,9 +54,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "2.33.3" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "bitflags", "textwrap", @@ -71,9 +65,9 @@ dependencies = [ [[package]] name = "criterion" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1604dafd25fba2fe2d5895a9da139f8dc9b319a5fe5354ca137cbbce4e178d10" +checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f" dependencies = [ "atty", "cast", @@ -97,65 +91,45 @@ dependencies = [ [[package]] name = "criterion-plot" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d00996de9f2f7559f7f4dc286073197f83e92256a59ed395f9aac01fe717da57" +checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" dependencies = [ "cast", "itertools", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - [[package]] name = "crossbeam-deque" -version = "0.8.1" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.5" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "cfg-if", "crossbeam-utils", - "lazy_static", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.5" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" -dependencies = [ - "cfg-if", - "lazy_static", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "csv" -version = "1.1.6" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" dependencies = [ - "bstr", "csv-core", "itoa", "ryu", @@ -164,24 +138,24 @@ dependencies = [ [[package]] name = "csv-core" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" dependencies = [ "memchr", ] [[package]] name = "either" -version = "1.6.1" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "half" -version = "1.7.1" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" +checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" [[package]] name = "hermit-abi" @@ -194,73 +168,61 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.1" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] [[package]] name = "itoa" -version = "0.4.7" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.52" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce791b7ca6638aae45be056e068fc756d871eb3b3b10b8efa62d1c9cec616752" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.98" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "log" -version = "0.4.14" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -dependencies = [ - "cfg-if", -] +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" -version = "2.4.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" - -[[package]] -name = "memoffset" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" -dependencies = [ - "autocfg", -] +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" -version = "2.0.4" +version = "2.0.5" dependencies = [ "criterion", "mime", @@ -269,22 +231,18 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] -name = "num_cpus" -version = "1.13.0" +name = "once_cell" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "oorandom" @@ -294,9 +252,9 @@ checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "plotters" -version = "0.3.1" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a3fd9ec30b9749ce28cd91f255d569591cdf937fe280c312143e3c4bad6f2a" +checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" dependencies = [ "num-traits", "plotters-backend", @@ -307,97 +265,91 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.2" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d88417318da0eaf0fdcdb51a0ee6c3bed624333bff8f946733049380be67ac1c" +checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" [[package]] name = "plotters-svg" -version = "0.3.1" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521fa9638fa597e1dc53e9412a4f9cefb01187ee1f7413076f9e6749e2885ba9" +checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" dependencies = [ "plotters-backend", ] [[package]] name = "proc-macro2" -version = "1.0.28" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.9" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] [[package]] name = "rayon" -version = "1.5.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.1" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "lazy_static", - "num_cpus", ] [[package]] name = "regex" -version = "1.5.4" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", "regex-syntax", ] [[package]] name = "regex-automata" -version = "0.1.10" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" - -[[package]] -name = "regex-syntax" -version = "0.6.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ - "semver", + "aho-corasick", + "memchr", + "regex-syntax", ] [[package]] -name = "ryu" -version = "1.0.5" +name = "regex-syntax" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "same-file" @@ -408,29 +360,20 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "semver" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012" - [[package]] name = "serde" -version = "1.0.127" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f03b9878abf6d14e6779d3f24f07b2cfa90352cfec4acc5aab8f1ac7f146fae8" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] [[package]] name = "serde_cbor" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" dependencies = [ "half", "serde", @@ -438,9 +381,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.127" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a024926d3432516606328597e0f224a51355a493b49fdd67e9209187cbe55ecc" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", @@ -449,9 +392,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.66" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "336b10da19a12ad094b59d870ebde26a45402e5b470add4b5fd03c5048a32127" +checksum = "d947f6b3163d8857ea16c4fa0dd4840d52f3041039a85decd46867eb1abef2e4" dependencies = [ "itoa", "ryu", @@ -460,13 +403,13 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.74" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] @@ -490,47 +433,46 @@ dependencies = [ [[package]] name = "unicase" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" dependencies = [ "version_check", ] [[package]] -name = "unicode-width" -version = "0.1.8" +name = "unicode-ident" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] -name = "unicode-xid" -version = "0.2.2" +name = "unicode-width" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", - "winapi", "winapi-util", ] [[package]] name = "wasm-bindgen" -version = "0.2.75" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b608ecc8f4198fe8680e2ed18eccab5f0cd4caaf3d83516fa5fb2e927fda2586" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -538,13 +480,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.75" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "580aa3a91a63d23aac5b6b267e2d13cb4f363e31dce6c352fca4752ae12e479f" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", - "lazy_static", "log", + "once_cell", "proc-macro2", "quote", "syn", @@ -553,9 +495,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.75" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "171ebf0ed9e1458810dfcb31f2e766ad6b3a89dbda42d8901f2b268277e5f09c" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -563,9 +505,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.75" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c2657dd393f03aa2a659c25c6ae18a13a4048cebd220e147933ea837efc589f" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", @@ -576,15 +518,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.75" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e0c4a743a309662d45f4ede961d7afa4ba4131a59a639f29b0069c3798bbcc2" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.52" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01c70a82d842c9979078c772d4a1344685045f1a5628f677c2b2eab4dd7d2696" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -608,11 +550,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys", ] [[package]] @@ -620,3 +562,76 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" diff --git a/third_party/rust/mime_guess/Cargo.toml b/third_party/rust/mime_guess/Cargo.toml index fc6f68d2a731..401a74a5e517 100644 --- a/third_party/rust/mime_guess/Cargo.toml +++ b/third_party/rust/mime_guess/Cargo.toml @@ -11,12 +11,16 @@ [package] name = "mime_guess" -version = "2.0.4" +version = "2.0.5" authors = ["Austin Bonander "] description = "A simple crate for detection of a file's MIME type by its extension." documentation = "https://docs.rs/mime_guess/" readme = "README.md" -keywords = ["mime", "filesystem", "extension"] +keywords = [ + "mime", + "filesystem", + "extension", +] license = "MIT" repository = "https://github.com/abonander/mime_guess" @@ -27,13 +31,16 @@ required-features = ["rev-mappings"] [[bench]] name = "benchmark" harness = false + [dependencies.mime] version = "0.3" [dependencies.unicase] version = "2.4.0" + [dev-dependencies.criterion] version = "0.3" + [build-dependencies.unicase] version = "2.4.0" diff --git a/third_party/rust/mime_guess/LICENSE b/third_party/rust/mime_guess/LICENSE index e3a186285799..d4e2bcdb613b 100644 --- a/third_party/rust/mime_guess/LICENSE +++ b/third_party/rust/mime_guess/LICENSE @@ -1,22 +1,22 @@ -The MIT License (MIT) - -Copyright (c) 2015 Austin Bonander - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - +The MIT License (MIT) + +Copyright (c) 2015 Austin Bonander + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/third_party/rust/mime_guess/README.md b/third_party/rust/mime_guess/README.md index 6e774503a4b5..28989bb1b2c4 100644 --- a/third_party/rust/mime_guess/README.md +++ b/third_party/rust/mime_guess/README.md @@ -1,86 +1,86 @@ -# mime_guess ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/abonander/mime_guess/Rust) [![Crates.io](https://img.shields.io/crates/v/mime_guess.svg)](https://crates.io/crates/mime_guess) - -MIME/MediaType guessing by file extension. -Uses a static map of known file extension -> MIME type mappings. - -**Returning Contributors: New Requirements for Submissions Below** - -##### Required Rust Version: 1.33 - -#### [Documentation](https://docs.rs/mime_guess/) - -### Versioning - -Due to a mistaken premature release, `mime_guess` currently publicly depends on a pre-1.0 `mime`, -which means `mime` upgrades are breaking changes and necessitate a major version bump. -Refer to the following table to find a version of `mime_guess` which matches your version of `mime`: - -| `mime` version | `mime_guess` version | -|----------------|----------------------| -| `0.1.x, 0.2.x` | `1.x.y` | -| `0.3.x` | `2.x.y` | - -#### Note: MIME Types Returned Are Not Stable/Guaranteed -The media types returned for a given extension are not considered to be part of the crate's - stable API and are often updated in patch (`x.y.z + 1`) releases to be as correct as possible. MIME - changes are backported to previous major releases on a best-effort basis. - -Note that only the extensions of paths/filenames are inspected in order to guess the MIME type. The -file that may or may not reside at that path may or may not be a valid file of the returned MIME type. -Be wary of unsafe or un-validated assumptions about file structure or length. - -An extension may also have multiple applicable MIME types. When more than one is returned, the first -is considered to be the most "correct"--see below for elaboration. - -Contributing ------------ - -#### Adding or correcting MIME types for extensions - -Is the MIME type for a file extension wrong or missing? Great! -Well, not great for us, but great for you if you'd like to open a pull request! - -The file extension -> MIME type mappings are listed in `src/mime_types.rs`. -**The list is sorted lexicographically by file extension, and all extensions are lowercase (where applicable).** -The former is necessary to support fallback to binary search when the -`phf-map` feature is turned off, and for the maintainers' sanity. -The latter is only for consistency's sake; the search is case-insensitive. - -Simply add or update the appropriate string pair(s) to make the correction(s) needed. -Run `cargo test` to make sure the library continues to work correctly. - -#### Important! Citing the corrected MIME type - -When opening a pull request, please include a link to an official document or RFC noting -the correct MIME type for the file type in question **in the commit message** so -that the commit history can be used as an audit trail. - -Though we're only guessing here, we like to be as correct as we can. -It makes it much easier to vet your contribution if we don't have to search for corroborating material. - -#### Multiple MIME types per extension -As of `2.0.0`, multiple MIME types per extension are supported. The first MIME type in the list for -a given extension should be the most "correct" so users who only care about getting a single MIME -type can use the `first*()` methods. - -The definition of "correct" is open to debate, however. In the author's opinion this should be -whatever is defined by the latest IETF RFC for the given file format, or otherwise explicitly -supercedes all others. - -If an official IANA registration replaces an older "experimental" style media type, please -place the new type before the old type in the list, but keep the old type for reference: - -``` -- ("md", &["text/x-markdown"]), -+ ("md", &["text/markdown", "text/x-markdown"]), -``` - -#### Changes to the API or operation of the crate - -We're open to changes to the crate's API or its inner workings, breaking or not, if it improves the overall operation, efficiency, or ergonomics of the crate. However, it would be a good idea to open an issue on the repository so we can discuss your proposed changes and decide how best to approach them. - - -License -------- - -MIT (See the `LICENSE` file in this repository for more information.) +# mime_guess ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/abonander/mime_guess/rust.yml?branch=master) [![Crates.io](https://img.shields.io/crates/v/mime_guess.svg)](https://crates.io/crates/mime_guess) + +MIME/MediaType guessing by file extension. +Uses a static map of known file extension -> MIME type mappings. + +**Returning Contributors: New Requirements for Submissions Below** + +##### Required Rust Version: 1.33 + +#### [Documentation](https://docs.rs/mime_guess/) + +### Versioning + +Due to a mistaken premature release, `mime_guess` currently publicly depends on a pre-1.0 `mime`, +which means `mime` upgrades are breaking changes and necessitate a major version bump. +Refer to the following table to find a version of `mime_guess` which matches your version of `mime`: + +| `mime` version | `mime_guess` version | +|----------------|----------------------| +| `0.1.x, 0.2.x` | `1.x.y` | +| `0.3.x` | `2.x.y` | + +#### Note: MIME Types Returned Are Not Stable/Guaranteed +The media types returned for a given extension are not considered to be part of the crate's + stable API and are often updated in patch (`x.y.z + 1`) releases to be as correct as possible. MIME + changes are backported to previous major releases on a best-effort basis. + +Note that only the extensions of paths/filenames are inspected in order to guess the MIME type. The +file that may or may not reside at that path may or may not be a valid file of the returned MIME type. +Be wary of unsafe or un-validated assumptions about file structure or length. + +An extension may also have multiple applicable MIME types. When more than one is returned, the first +is considered to be the most "correct"--see below for elaboration. + +Contributing +----------- + +#### Adding or correcting MIME types for extensions + +Is the MIME type for a file extension wrong or missing? Great! +Well, not great for us, but great for you if you'd like to open a pull request! + +The file extension -> MIME type mappings are listed in `src/mime_types.rs`. +**The list is sorted lexicographically by file extension, and all extensions are lowercase (where applicable).** +The former is necessary to support fallback to binary search when the +`phf-map` feature is turned off, and for the maintainers' sanity. +The latter is only for consistency's sake; the search is case-insensitive. + +Simply add or update the appropriate string pair(s) to make the correction(s) needed. +Run `cargo test` to make sure the library continues to work correctly. + +#### Important! Citing the corrected MIME type + +When opening a pull request, please include a link to an official document or RFC noting +the correct MIME type for the file type in question **in the commit message** so +that the commit history can be used as an audit trail. + +Though we're only guessing here, we like to be as correct as we can. +It makes it much easier to vet your contribution if we don't have to search for corroborating material. + +#### Multiple MIME types per extension +As of `2.0.0`, multiple MIME types per extension are supported. The first MIME type in the list for +a given extension should be the most "correct" so users who only care about getting a single MIME +type can use the `first*()` methods. + +The definition of "correct" is open to debate, however. In the author's opinion this should be +whatever is defined by the latest IETF RFC for the given file format, or otherwise explicitly +supercedes all others. + +If an official IANA registration replaces an older "experimental" style media type, please +place the new type before the old type in the list, but keep the old type for reference: + +``` +- ("md", &["text/x-markdown"]), ++ ("md", &["text/markdown", "text/x-markdown"]), +``` + +#### Changes to the API or operation of the crate + +We're open to changes to the crate's API or its inner workings, breaking or not, if it improves the overall operation, efficiency, or ergonomics of the crate. However, it would be a good idea to open an issue on the repository so we can discuss your proposed changes and decide how best to approach them. + + +License +------- + +MIT (See the `LICENSE` file in this repository for more information.) diff --git a/third_party/rust/mime_guess/benches/benchmark.rs b/third_party/rust/mime_guess/benches/benchmark.rs index 4a7af2e5842d..34ba59bd9bed 100644 --- a/third_party/rust/mime_guess/benches/benchmark.rs +++ b/third_party/rust/mime_guess/benches/benchmark.rs @@ -1,31 +1,31 @@ -#[macro_use] -extern crate criterion; -extern crate mime_guess; - -use self::criterion::Criterion; - -use mime_guess::from_ext; - -include!("../src/mime_types.rs"); - -/// WARNING: this may take a while! -fn bench_mime_str(c: &mut Criterion) { - c.bench_function("from_ext", |b| { - for (mime_ext, _) in MIME_TYPES { - b.iter(|| from_ext(mime_ext).first_raw()); - } - }); -} - -fn bench_mime_str_uppercase(c: &mut Criterion) { - c.bench_function("from_ext uppercased", |b| { - let uppercased = MIME_TYPES.into_iter().map(|(s, _)| s.to_uppercase()); - - for mime_ext in uppercased { - b.iter(|| from_ext(&mime_ext).first_raw()); - } - }); -} - -criterion_group!(benches, bench_mime_str, bench_mime_str_uppercase); -criterion_main!(benches); +#[macro_use] +extern crate criterion; +extern crate mime_guess; + +use self::criterion::Criterion; + +use mime_guess::from_ext; + +include!("../src/mime_types.rs"); + +/// WARNING: this may take a while! +fn bench_mime_str(c: &mut Criterion) { + c.bench_function("from_ext", |b| { + for (mime_ext, _) in MIME_TYPES { + b.iter(|| from_ext(mime_ext).first_raw()); + } + }); +} + +fn bench_mime_str_uppercase(c: &mut Criterion) { + c.bench_function("from_ext uppercased", |b| { + let uppercased = MIME_TYPES.into_iter().map(|(s, _)| s.to_uppercase()); + + for mime_ext in uppercased { + b.iter(|| from_ext(&mime_ext).first_raw()); + } + }); +} + +criterion_group!(benches, bench_mime_str, bench_mime_str_uppercase); +criterion_main!(benches); diff --git a/third_party/rust/mime_guess/build.rs b/third_party/rust/mime_guess/build.rs index ff4ea764efe9..3a59d5d31b27 100644 --- a/third_party/rust/mime_guess/build.rs +++ b/third_party/rust/mime_guess/build.rs @@ -1,191 +1,196 @@ -#[cfg(feature = "phf")] -extern crate phf_codegen; -extern crate unicase; - -use unicase::UniCase; - -use std::env; -use std::fs::File; -use std::io::prelude::*; -use std::io::BufWriter; -use std::path::Path; - -use std::collections::BTreeMap; - -use mime_types::MIME_TYPES; - -#[path = "src/mime_types.rs"] -mod mime_types; - -#[cfg(feature = "phf")] -const PHF_PATH: &str = "::impl_::phf"; - -fn main() { - let out_dir = env::var("OUT_DIR").unwrap(); - let dest_path = Path::new(&out_dir).join("mime_types_generated.rs"); - let mut outfile = BufWriter::new(File::create(dest_path).unwrap()); - - #[cfg(feature = "phf")] - build_forward_map(&mut outfile); - - #[cfg(feature = "rev-mappings")] - build_rev_map(&mut outfile); -} - -// Build forward mappings (ext -> mime type) -#[cfg(feature = "phf")] -fn build_forward_map(out: &mut W) { - use phf_codegen::Map as PhfMap; - - let mut forward_map = PhfMap::new(); - forward_map.phf_path(PHF_PATH); - - let mut map_entries: Vec<(&str, Vec<&str>)> = Vec::new(); - - for &(key, types) in MIME_TYPES { - if let Some(&mut (key_, ref mut values)) = map_entries.last_mut() { - // deduplicate extensions - if key == key_ { - values.extend_from_slice(types); - continue; - } - } - - map_entries.push((key, types.into())); - } - - for (key, values) in map_entries { - forward_map.entry( - UniCase::new(key), - &format!("&{:?}", values), - ); - } - - writeln!( - out, - "static MIME_TYPES: phf::Map, &'static [&'static str]> = \n{};", - forward_map.build() - ) - .unwrap(); -} - -// Build reverse mappings (mime type -> ext) -#[cfg(all(feature = "phf", feature = "rev-mappings"))] -fn build_rev_map(out: &mut W) { - use phf_codegen::Map as PhfMap; - - let dyn_map = get_rev_mappings(); - - let mut rev_map = PhfMap::new(); - rev_map.phf_path(PHF_PATH); - - let mut exts = Vec::new(); - - for (top, subs) in dyn_map { - let top_start = exts.len(); - - let mut sub_map = PhfMap::new(); - sub_map.phf_path(PHF_PATH); - - for (sub, sub_exts) in subs { - let sub_start = exts.len(); - exts.extend(sub_exts); - let sub_end = exts.len(); - - sub_map.entry(sub, &format!("({}, {})", sub_start, sub_end)); - } - - let top_end = exts.len(); - - rev_map.entry( - top, - &format!( - "TopLevelExts {{ start: {}, end: {}, subs: {} }}", - top_start, top_end, sub_map.build() - ), - ); - } - - writeln!( - out, - "static REV_MAPPINGS: phf::Map, TopLevelExts> = \n{};", - rev_map.build() - ).unwrap(); - - writeln!(out, "const EXTS: &'static [&'static str] = &{:?};", exts).unwrap(); -} - -#[cfg(all(not(feature = "phf"), feature = "rev-mappings"))] -fn build_rev_map(out: &mut W) { - use std::fmt::Write as _; - - macro_rules! unicase_const { - ($s:expr) => ({ - format_args!("{}({:?})", (if $s.is_ascii() { - "UniCase::ascii" - } else { - "UniCase::unicode" - }), $s) - }) - } - - let dyn_map = get_rev_mappings(); - - write!(out, "static REV_MAPPINGS: &'static [(UniCase<&'static str>, TopLevelExts)] = &[").unwrap(); - - let mut exts = Vec::new(); - - for (top, subs) in dyn_map { - let top_start = exts.len(); - - let mut sub_map = String::new(); - - for (sub, sub_exts) in subs { - let sub_start = exts.len(); - exts.extend(sub_exts); - let sub_end = exts.len(); - - write!( - sub_map, - "({}, ({}, {})),", - unicase_const!(sub), sub_start, sub_end - ).unwrap(); - } - - let top_end = exts.len(); - - write!( - out, - "({}, TopLevelExts {{ start: {}, end: {}, subs: &[{}] }}),", - unicase_const!(top), top_start, top_end, sub_map - ).unwrap(); - } - - writeln!(out, "];").unwrap(); - - writeln!(out, "const EXTS: &'static [&'static str] = &{:?};", exts).unwrap(); -} - -#[cfg(feature = "rev-mappings")] -fn get_rev_mappings( -) -> BTreeMap, BTreeMap, Vec<&'static str>>> { - // First, collect all the mime type -> ext mappings) - let mut dyn_map = BTreeMap::new(); - for &(key, types) in MIME_TYPES { - for val in types { - let (top, sub) = split_mime(val); - dyn_map - .entry(UniCase::new(top)) - .or_insert_with(BTreeMap::new) - .entry(UniCase::new(sub)) - .or_insert_with(Vec::new) - .push(key); - } - } - dyn_map -} - -fn split_mime(mime: &str) -> (&str, &str) { - let split_idx = mime.find('/').unwrap(); - (&mime[..split_idx], &mime[split_idx + 1..]) -} +#[cfg(feature = "phf")] +extern crate phf_codegen; +extern crate unicase; + +use unicase::UniCase; + +use std::env; +use std::fs::File; +use std::io::prelude::*; +use std::io::BufWriter; +use std::path::Path; + +use std::collections::BTreeMap; + +use mime_types::MIME_TYPES; + +#[path = "src/mime_types.rs"] +mod mime_types; + +#[cfg(feature = "phf")] +const PHF_PATH: &str = "::impl_::phf"; + +fn main() { + let out_dir = env::var("OUT_DIR").unwrap(); + let dest_path = Path::new(&out_dir).join("mime_types_generated.rs"); + let mut outfile = BufWriter::new(File::create(&dest_path).unwrap()); + + println!( + "cargo:rustc-env=MIME_TYPES_GENERATED_PATH={}", + dest_path.display() + ); + + #[cfg(feature = "phf")] + build_forward_map(&mut outfile); + + #[cfg(feature = "rev-mappings")] + build_rev_map(&mut outfile); +} + +// Build forward mappings (ext -> mime type) +#[cfg(feature = "phf")] +fn build_forward_map(out: &mut W) { + use phf_codegen::Map as PhfMap; + + let mut forward_map = PhfMap::new(); + forward_map.phf_path(PHF_PATH); + + let mut map_entries: Vec<(&str, Vec<&str>)> = Vec::new(); + + for &(key, types) in MIME_TYPES { + if let Some(&mut (key_, ref mut values)) = map_entries.last_mut() { + // deduplicate extensions + if key == key_ { + values.extend_from_slice(types); + continue; + } + } + + map_entries.push((key, types.into())); + } + + for (key, values) in map_entries { + forward_map.entry( + UniCase::new(key), + &format!("&{:?}", values), + ); + } + + writeln!( + out, + "static MIME_TYPES: phf::Map, &'static [&'static str]> = \n{};", + forward_map.build() + ) + .unwrap(); +} + +// Build reverse mappings (mime type -> ext) +#[cfg(all(feature = "phf", feature = "rev-mappings"))] +fn build_rev_map(out: &mut W) { + use phf_codegen::Map as PhfMap; + + let dyn_map = get_rev_mappings(); + + let mut rev_map = PhfMap::new(); + rev_map.phf_path(PHF_PATH); + + let mut exts = Vec::new(); + + for (top, subs) in dyn_map { + let top_start = exts.len(); + + let mut sub_map = PhfMap::new(); + sub_map.phf_path(PHF_PATH); + + for (sub, sub_exts) in subs { + let sub_start = exts.len(); + exts.extend(sub_exts); + let sub_end = exts.len(); + + sub_map.entry(sub, &format!("({}, {})", sub_start, sub_end)); + } + + let top_end = exts.len(); + + rev_map.entry( + top, + &format!( + "TopLevelExts {{ start: {}, end: {}, subs: {} }}", + top_start, top_end, sub_map.build() + ), + ); + } + + writeln!( + out, + "static REV_MAPPINGS: phf::Map, TopLevelExts> = \n{};", + rev_map.build() + ).unwrap(); + + writeln!(out, "const EXTS: &'static [&'static str] = &{:?};", exts).unwrap(); +} + +#[cfg(all(not(feature = "phf"), feature = "rev-mappings"))] +fn build_rev_map(out: &mut W) { + use std::fmt::Write as _; + + macro_rules! unicase_const { + ($s:expr) => ({ + format_args!("{}({:?})", (if $s.is_ascii() { + "UniCase::ascii" + } else { + "UniCase::unicode" + }), $s) + }) + } + + let dyn_map = get_rev_mappings(); + + write!(out, "static REV_MAPPINGS: &'static [(UniCase<&'static str>, TopLevelExts)] = &[").unwrap(); + + let mut exts = Vec::new(); + + for (top, subs) in dyn_map { + let top_start = exts.len(); + + let mut sub_map = String::new(); + + for (sub, sub_exts) in subs { + let sub_start = exts.len(); + exts.extend(sub_exts); + let sub_end = exts.len(); + + write!( + sub_map, + "({}, ({}, {})),", + unicase_const!(sub), sub_start, sub_end + ).unwrap(); + } + + let top_end = exts.len(); + + write!( + out, + "({}, TopLevelExts {{ start: {}, end: {}, subs: &[{}] }}),", + unicase_const!(top), top_start, top_end, sub_map + ).unwrap(); + } + + writeln!(out, "];").unwrap(); + + writeln!(out, "const EXTS: &'static [&'static str] = &{:?};", exts).unwrap(); +} + +#[cfg(feature = "rev-mappings")] +fn get_rev_mappings( +) -> BTreeMap, BTreeMap, Vec<&'static str>>> { + // First, collect all the mime type -> ext mappings) + let mut dyn_map = BTreeMap::new(); + for &(key, types) in MIME_TYPES { + for val in types { + let (top, sub) = split_mime(val); + dyn_map + .entry(UniCase::new(top)) + .or_insert_with(BTreeMap::new) + .entry(UniCase::new(sub)) + .or_insert_with(Vec::new) + .push(key); + } + } + dyn_map +} + +fn split_mime(mime: &str) -> (&str, &str) { + let split_idx = mime.find('/').unwrap(); + (&mime[..split_idx], &mime[split_idx + 1..]) +} diff --git a/third_party/rust/mime_guess/examples/rev_map.rs b/third_party/rust/mime_guess/examples/rev_map.rs index f6f2fdeaf9aa..444ac139c21e 100644 --- a/third_party/rust/mime_guess/examples/rev_map.rs +++ b/third_party/rust/mime_guess/examples/rev_map.rs @@ -1,14 +1,14 @@ -extern crate mime_guess; - -fn main() { - print_exts("video/*"); - print_exts("video/x-matroska"); -} - -fn print_exts(mime_type: &str) { - println!( - "Exts for {:?}: {:?}", - mime_type, - mime_guess::get_mime_extensions_str(mime_type) - ); -} +extern crate mime_guess; + +fn main() { + print_exts("video/*"); + print_exts("video/x-matroska"); +} + +fn print_exts(mime_type: &str) { + println!( + "Exts for {:?}: {:?}", + mime_type, + mime_guess::get_mime_extensions_str(mime_type) + ); +} diff --git a/third_party/rust/mime_guess/src/impl_bin_search.rs b/third_party/rust/mime_guess/src/impl_bin_search.rs index 2653714505af..fee2cb681ee8 100644 --- a/third_party/rust/mime_guess/src/impl_bin_search.rs +++ b/third_party/rust/mime_guess/src/impl_bin_search.rs @@ -1,41 +1,41 @@ -use unicase::UniCase; - -include!("mime_types.rs"); -include!(concat!(env!("OUT_DIR"), "/mime_types_generated.rs")); - -#[cfg(feature = "rev-mappings")] -#[derive(Copy, Clone)] -struct TopLevelExts { - start: usize, - end: usize, - subs: &'static [(UniCase<&'static str>, (usize, usize))], -} - -pub fn get_mime_types(ext: &str) -> Option<&'static [&'static str]> { - let ext = UniCase::new(ext); - - map_lookup(MIME_TYPES, &ext) -} - -#[cfg(feature = "rev-mappings")] -pub fn get_extensions(toplevel: &str, sublevel: &str) -> Option<&'static [&'static str]> { - if toplevel == "*" { - return Some(EXTS); - } - - let top = map_lookup(REV_MAPPINGS, toplevel)?; - - if sublevel == "*" { - return Some(&EXTS[top.start..top.end]); - } - - let sub = map_lookup(&top.subs, sublevel)?; - Some(&EXTS[sub.0..sub.1]) -} - -fn map_lookup(map: &'static [(K, V)], key: &str) -> Option - where K: Copy + Into>, V: Copy { - map.binary_search_by_key(&UniCase::new(key), |(k, _)| (*k).into()) - .ok() - .map(|i| map[i].1) -} +use unicase::UniCase; + +include!("mime_types.rs"); +include!(env!("MIME_TYPES_GENERATED_PATH")); + +#[cfg(feature = "rev-mappings")] +#[derive(Copy, Clone)] +struct TopLevelExts { + start: usize, + end: usize, + subs: &'static [(UniCase<&'static str>, (usize, usize))], +} + +pub fn get_mime_types(ext: &str) -> Option<&'static [&'static str]> { + let ext = UniCase::new(ext); + + map_lookup(MIME_TYPES, &ext) +} + +#[cfg(feature = "rev-mappings")] +pub fn get_extensions(toplevel: &str, sublevel: &str) -> Option<&'static [&'static str]> { + if toplevel == "*" { + return Some(EXTS); + } + + let top = map_lookup(REV_MAPPINGS, toplevel)?; + + if sublevel == "*" { + return Some(&EXTS[top.start..top.end]); + } + + let sub = map_lookup(&top.subs, sublevel)?; + Some(&EXTS[sub.0..sub.1]) +} + +fn map_lookup(map: &'static [(K, V)], key: &str) -> Option + where K: Copy + Into>, V: Copy { + map.binary_search_by_key(&UniCase::new(key), |(k, _)| (*k).into()) + .ok() + .map(|i| map[i].1) +} diff --git a/third_party/rust/mime_guess/src/impl_phf.rs b/third_party/rust/mime_guess/src/impl_phf.rs index 980c31f369f9..68b4bfacb18d 100644 --- a/third_party/rust/mime_guess/src/impl_phf.rs +++ b/third_party/rust/mime_guess/src/impl_phf.rs @@ -1,40 +1,40 @@ -extern crate phf; - -use unicase::UniCase; - -include!(concat!(env!("OUT_DIR"), "/mime_types_generated.rs")); - -#[cfg(feature = "rev-mappings")] -struct TopLevelExts { - start: usize, - end: usize, - subs: phf::Map, (usize, usize)>, -} - -pub fn get_mime_types(ext: &str) -> Option<&'static [&'static str]> { - map_lookup(&MIME_TYPES, ext).cloned() -} - -pub fn get_extensions(toplevel: &str, sublevel: &str) -> Option<&'static [&'static str]> { - if toplevel == "*" { - return Some(EXTS); - } - - let top = map_lookup(&REV_MAPPINGS, toplevel)?; - - if sublevel == "*" { - return Some(&EXTS[top.start..top.end]); - } - - let sub = map_lookup(&top.subs, sublevel)?; - Some(&EXTS[sub.0..sub.1]) -} - -fn map_lookup<'key, 'map: 'key, V>( - map: &'map phf::Map, V>, - key: &'key str, -) -> Option<&'map V> { - // FIXME: this doesn't compile unless we transmute `key` to `UniCase<&'static str>` - // https://github.com/sfackler/rust-phf/issues/169 - map.get(&UniCase::new(key)) -} +extern crate phf; + +use unicase::UniCase; + +include!(env!("MIME_TYPES_GENERATED_PATH")); + +#[cfg(feature = "rev-mappings")] +struct TopLevelExts { + start: usize, + end: usize, + subs: phf::Map, (usize, usize)>, +} + +pub fn get_mime_types(ext: &str) -> Option<&'static [&'static str]> { + map_lookup(&MIME_TYPES, ext).cloned() +} + +pub fn get_extensions(toplevel: &str, sublevel: &str) -> Option<&'static [&'static str]> { + if toplevel == "*" { + return Some(EXTS); + } + + let top = map_lookup(&REV_MAPPINGS, toplevel)?; + + if sublevel == "*" { + return Some(&EXTS[top.start..top.end]); + } + + let sub = map_lookup(&top.subs, sublevel)?; + Some(&EXTS[sub.0..sub.1]) +} + +fn map_lookup<'key, 'map: 'key, V>( + map: &'map phf::Map, V>, + key: &'key str, +) -> Option<&'map V> { + // FIXME: this doesn't compile unless we transmute `key` to `UniCase<&'static str>` + // https://github.com/sfackler/rust-phf/issues/169 + map.get(&UniCase::new(key)) +} diff --git a/third_party/rust/mime_guess/src/lib.rs b/third_party/rust/mime_guess/src/lib.rs index e2563f495a73..6e17f45af115 100644 --- a/third_party/rust/mime_guess/src/lib.rs +++ b/third_party/rust/mime_guess/src/lib.rs @@ -1,534 +1,534 @@ -//! Guessing of MIME types by file extension. -//! -//! Uses a static list of file-extension : MIME type mappings. -//! -//! ``` -//! # extern crate mime; -//! // the file doesn't have to exist, it just looks at the path -//! let guess = mime_guess::from_path("some_file.gif"); -//! assert_eq!(guess.first(), Some(mime::IMAGE_GIF)); -//! -//! ``` -//! -//! #### Note: MIME Types Returned Are Not Stable/Guaranteed -//! The media types returned for a given extension are not considered to be part of the crate's -//! stable API and are often updated in patch
(`x.y.[z + 1]`) releases to be as correct as -//! possible. -//! -//! Additionally, only the extensions of paths/filenames are inspected in order to guess the MIME -//! type. The file that may or may not reside at that path may or may not be a valid file of the -//! returned MIME type. Be wary of unsafe or un-validated assumptions about file structure or -//! length. -pub extern crate mime; -extern crate unicase; - -pub use mime::Mime; - -use std::ffi::OsStr; -use std::iter::FusedIterator; -use std::path::Path; -use std::{iter, slice}; - -#[cfg(feature = "phf")] -#[path = "impl_phf.rs"] -mod impl_; - -#[cfg(not(feature = "phf"))] -#[path = "impl_bin_search.rs"] -mod impl_; - -/// A "guess" of the MIME/Media Type(s) of an extension or path as one or more -/// [`Mime`](struct.Mime.html) instances. -/// -/// ### Note: Ordering -/// A given file format may have one or more applicable Media Types; in this case -/// the first Media Type returned is whatever is declared in the latest IETF RFC for the -/// presumed file format or the one that explicitly supercedes all others. -/// Ordering of additional Media Types is arbitrary. -/// -/// ### Note: Values Not Stable -/// The exact Media Types returned in any given guess are not considered to be stable and are often -/// updated in patch releases in order to reflect the most up-to-date information possible. -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -// FIXME: change repr when `mime` gains macro/const fn constructor -pub struct MimeGuess(&'static [&'static str]); - -impl MimeGuess { - /// Guess the MIME type of a file (real or otherwise) with the given extension. - /// - /// The search is case-insensitive. - /// - /// If `ext` is empty or has no (currently) known MIME type mapping, then an empty guess is - /// returned. - pub fn from_ext(ext: &str) -> MimeGuess { - if ext.is_empty() { - return MimeGuess(&[]); - } - - impl_::get_mime_types(ext).map_or(MimeGuess(&[]), |v| MimeGuess(v)) - } - - /// Guess the MIME type of `path` by its extension (as defined by - /// [`Path::extension()`]). **No disk access is performed.** - /// - /// If `path` has no extension, the extension cannot be converted to `str`, or has - /// no known MIME type mapping, then an empty guess is returned. - /// - /// The search is case-insensitive. - /// - /// ## Note - /// **Guess** is the operative word here, as there are no guarantees that the contents of the - /// file that `path` points to match the MIME type associated with the path's extension. - /// - /// Take care when processing files with assumptions based on the return value of this function. - /// - /// [`Path::extension()`]: https://doc.rust-lang.org/std/path/struct.Path.html#method.extension - pub fn from_path>(path: P) -> MimeGuess { - path.as_ref() - .extension() - .and_then(OsStr::to_str) - .map_or(MimeGuess(&[]), Self::from_ext) - } - - /// `true` if the guess did not return any known mappings for the given path or extension. - pub fn is_empty(&self) -> bool { - self.0.is_empty() - } - - /// Get the number of MIME types in the current guess. - pub fn count(&self) -> usize { - self.0.len() - } - - /// Get the first guessed `Mime`, if applicable. - /// - /// See [Note: Ordering](#note-ordering) above. - pub fn first(&self) -> Option { - self.first_raw().map(expect_mime) - } - - /// Get the first guessed Media Type as a string, if applicable. - /// - /// See [Note: Ordering](#note-ordering) above. - pub fn first_raw(&self) -> Option<&'static str> { - self.0.get(0).cloned() - } - - /// Get the first guessed `Mime`, or if the guess is empty, return - /// [`application/octet-stream`] instead. - /// - /// See [Note: Ordering](#note-ordering) above. - /// - /// ### Note: HTTP Applications - /// For HTTP request and response bodies if a value for the `Content-Type` header - /// cannot be determined it might be preferable to not send one at all instead of defaulting to - /// `application/octet-stream` as the recipient will expect to infer the format directly from - /// the content instead. ([RFC 7231, Section 3.1.1.5][rfc7231]) - /// - /// On the contrary, for `multipart/form-data` bodies, the `Content-Type` of a form-data part is - /// assumed to be `text/plain` unless specified so a default of `application/octet-stream` - /// for non-text parts is safer. ([RFC 7578, Section 4.4][rfc7578]) - /// - /// [`application/octet-stream`]: https://docs.rs/mime/0.3/mime/constant.APPLICATION_OCTET_STREAM.html - /// [rfc7231]: https://tools.ietf.org/html/rfc7231#section-3.1.1.5 - /// [rfc7578]: https://tools.ietf.org/html/rfc7578#section-4.4 - pub fn first_or_octet_stream(&self) -> Mime { - self.first_or(mime::APPLICATION_OCTET_STREAM) - } - - /// Get the first guessed `Mime`, or if the guess is empty, return - /// [`text/plain`](::mime::TEXT_PLAIN) instead. - /// - /// See [Note: Ordering](#note-ordering) above. - pub fn first_or_text_plain(&self) -> Mime { - self.first_or(mime::TEXT_PLAIN) - } - - /// Get the first guessed `Mime`, or if the guess is empty, return the given `Mime` instead. - /// - /// See [Note: Ordering](#note-ordering) above. - pub fn first_or(&self, default: Mime) -> Mime { - self.first().unwrap_or(default) - } - - /// Get the first guessed `Mime`, or if the guess is empty, execute the closure and return its - /// result. - /// - /// See [Note: Ordering](#note-ordering) above. - pub fn first_or_else(&self, default_fn: F) -> Mime - where - F: FnOnce() -> Mime, - { - self.first().unwrap_or_else(default_fn) - } - - /// Get an iterator over the `Mime` values contained in this guess. - /// - /// See [Note: Ordering](#note-ordering) above. - pub fn iter(&self) -> Iter { - Iter(self.iter_raw().map(expect_mime)) - } - - /// Get an iterator over the raw media-type strings in this guess. - /// - /// See [Note: Ordering](#note-ordering) above. - pub fn iter_raw(&self) -> IterRaw { - IterRaw(self.0.iter().cloned()) - } -} - -impl IntoIterator for MimeGuess { - type Item = Mime; - type IntoIter = Iter; - - fn into_iter(self) -> Self::IntoIter { - self.iter() - } -} - -impl<'a> IntoIterator for &'a MimeGuess { - type Item = Mime; - type IntoIter = Iter; - - fn into_iter(self) -> Self::IntoIter { - self.iter() - } -} - -/// An iterator over the `Mime` types of a `MimeGuess`. -/// -/// See [Note: Ordering on `MimeGuess`](struct.MimeGuess.html#note-ordering). -#[derive(Clone, Debug)] -pub struct Iter(iter::Map Mime>); - -impl Iterator for Iter { - type Item = Mime; - - fn next(&mut self) -> Option { - self.0.next() - } - - fn size_hint(&self) -> (usize, Option) { - self.0.size_hint() - } -} - -impl DoubleEndedIterator for Iter { - fn next_back(&mut self) -> Option { - self.0.next_back() - } -} - -impl FusedIterator for Iter {} - -impl ExactSizeIterator for Iter { - fn len(&self) -> usize { - self.0.len() - } -} - -/// An iterator over the raw media type strings of a `MimeGuess`. -/// -/// See [Note: Ordering on `MimeGuess`](struct.MimeGuess.html#note-ordering). -#[derive(Clone, Debug)] -pub struct IterRaw(iter::Cloned>); - -impl Iterator for IterRaw { - type Item = &'static str; - - fn next(&mut self) -> Option { - self.0.next() - } - - fn size_hint(&self) -> (usize, Option) { - self.0.size_hint() - } -} - -impl DoubleEndedIterator for IterRaw { - fn next_back(&mut self) -> Option { - self.0.next_back() - } -} - -impl FusedIterator for IterRaw {} - -impl ExactSizeIterator for IterRaw { - fn len(&self) -> usize { - self.0.len() - } -} - -fn expect_mime(s: &str) -> Mime { - // `.parse()` should be checked at compile time to never fail - s.parse() - .unwrap_or_else(|e| panic!("failed to parse media-type {:?}: {}", s, e)) -} - -/// Wrapper of [`MimeGuess::from_ext()`](struct.MimeGuess.html#method.from_ext). -pub fn from_ext(ext: &str) -> MimeGuess { - MimeGuess::from_ext(ext) -} - -/// Wrapper of [`MimeGuess::from_path()`](struct.MimeGuess.html#method.from_path). -pub fn from_path>(path: P) -> MimeGuess { - MimeGuess::from_path(path) -} - -/// Guess the MIME type of `path` by its extension (as defined by `Path::extension()`). -/// -/// If `path` has no extension, or its extension has no known MIME type mapping, -/// then the MIME type is assumed to be `application/octet-stream`. -/// -/// ## Note -/// **Guess** is the operative word here, as there are no guarantees that the contents of the file -/// that `path` points to match the MIME type associated with the path's extension. -/// -/// Take care when processing files with assumptions based on the return value of this function. -/// -/// In HTTP applications, it might be [preferable][rfc7231] to not send a `Content-Type` -/// header at all instead of defaulting to `application/octet-stream`. -/// -/// [rfc7231]: https://tools.ietf.org/html/rfc7231#section-3.1.1.5 -#[deprecated( - since = "2.0.0", - note = "Use `from_path(path).first_or_octet_stream()` instead" -)] -pub fn guess_mime_type>(path: P) -> Mime { - from_path(path).first_or_octet_stream() -} - -/// Guess the MIME type of `path` by its extension (as defined by `Path::extension()`). -/// -/// If `path` has no extension, or its extension has no known MIME type mapping, -/// then `None` is returned. -/// -#[deprecated(since = "2.0.0", note = "Use `from_path(path).first()` instead")] -pub fn guess_mime_type_opt>(path: P) -> Option { - from_path(path).first() -} - -/// Guess the MIME type string of `path` by its extension (as defined by `Path::extension()`). -/// -/// If `path` has no extension, or its extension has no known MIME type mapping, -/// then `None` is returned. -/// -/// ## Note -/// **Guess** is the operative word here, as there are no guarantees that the contents of the file -/// that `path` points to match the MIME type associated with the path's extension. -/// -/// Take care when processing files with assumptions based on the return value of this function. -#[deprecated(since = "2.0.0", note = "Use `from_path(path).first_raw()` instead")] -pub fn mime_str_for_path_ext>(path: P) -> Option<&'static str> { - from_path(path).first_raw() -} - -/// Get the MIME type associated with a file extension. -/// -/// If there is no association for the extension, or `ext` is empty, -/// `application/octet-stream` is returned. -/// -/// ## Note -/// In HTTP applications, it might be [preferable][rfc7231] to not send a `Content-Type` -/// header at all instead of defaulting to `application/octet-stream`. -/// -/// [rfc7231]: https://tools.ietf.org/html/rfc7231#section-3.1.1.5 -#[deprecated( - since = "2.0.0", - note = "use `from_ext(search_ext).first_or_octet_stream()` instead" -)] -pub fn get_mime_type(search_ext: &str) -> Mime { - from_ext(search_ext).first_or_octet_stream() -} - -/// Get the MIME type associated with a file extension. -/// -/// If there is no association for the extension, or `ext` is empty, -/// `None` is returned. -#[deprecated(since = "2.0.0", note = "use `from_ext(search_ext).first()` instead")] -pub fn get_mime_type_opt(search_ext: &str) -> Option { - from_ext(search_ext).first() -} - -/// Get the MIME type string associated with a file extension. Case-insensitive. -/// -/// If `search_ext` is not already lowercase, -/// it will be converted to lowercase to facilitate the search. -/// -/// Returns `None` if `search_ext` is empty or an associated extension was not found. -#[deprecated( - since = "2.0.0", - note = "use `from_ext(search_ext).first_raw()` instead" -)] -pub fn get_mime_type_str(search_ext: &str) -> Option<&'static str> { - from_ext(search_ext).first_raw() -} - -/// Get a list of known extensions for a given `Mime`. -/// -/// Ignores parameters (only searches with `
/`). Case-insensitive (for extension types). -/// -/// Returns `None` if the MIME type is unknown. -/// -/// ### Wildcards -/// If the top-level of the MIME type is a wildcard (`*`), returns all extensions. -/// -/// If the sub-level of the MIME type is a wildcard, returns all extensions for the top-level. -#[cfg(feature = "rev-mappings")] -pub fn get_mime_extensions(mime: &Mime) -> Option<&'static [&'static str]> { - get_extensions(mime.type_().as_ref(), mime.subtype().as_ref()) -} - -/// Get a list of known extensions for a MIME type string. -/// -/// Ignores parameters (only searches `
/`). Case-insensitive. -/// -/// Returns `None` if the MIME type is unknown. -/// -/// ### Wildcards -/// If the top-level of the MIME type is a wildcard (`*`), returns all extensions. -/// -/// If the sub-level of the MIME type is a wildcard, returns all extensions for the top-level. -/// -/// ### Panics -/// If `mime_str` is not a valid MIME type specifier (naive). -#[cfg(feature = "rev-mappings")] -pub fn get_mime_extensions_str(mut mime_str: &str) -> Option<&'static [&'static str]> { - mime_str = mime_str.trim(); - - if let Some(sep_idx) = mime_str.find(';') { - mime_str = &mime_str[..sep_idx]; - } - - let (top, sub) = { - let split_idx = mime_str.find('/')?; - (&mime_str[..split_idx], &mime_str[split_idx + 1..]) - }; - - get_extensions(top, sub) -} - -/// Get the extensions for a given top-level and sub-level of a MIME type -/// (`{toplevel}/{sublevel}`). -/// -/// Returns `None` if `toplevel` or `sublevel` are unknown. -/// -/// ### Wildcards -/// If the top-level of the MIME type is a wildcard (`*`), returns all extensions. -/// -/// If the sub-level of the MIME type is a wildcard, returns all extensions for the top-level. -#[cfg(feature = "rev-mappings")] -pub fn get_extensions(toplevel: &str, sublevel: &str) -> Option<&'static [&'static str]> { - impl_::get_extensions(toplevel, sublevel) -} - -/// Get the MIME type for `application/octet-stream` (generic binary stream) -#[deprecated(since = "2.0.0", note = "use `mime::APPLICATION_OCTET_STREAM` instead")] -pub fn octet_stream() -> Mime { - "application/octet-stream".parse().unwrap() -} - -#[cfg(test)] -mod tests { - include!("mime_types.rs"); - - use super::{expect_mime, from_ext, from_path, get_mime_extensions_str}; - #[allow(deprecated, unused_imports)] - use std::ascii::AsciiExt; - - use std::fmt::Debug; - use std::path::Path; - - #[test] - fn check_type_bounds() { - fn assert_type_bounds() {} - - assert_type_bounds::(); - assert_type_bounds::(); - assert_type_bounds::(); - } - - #[test] - fn test_mime_type_guessing() { - assert_eq!( - from_ext("gif").first_or_octet_stream().to_string(), - "image/gif".to_string() - ); - assert_eq!( - from_ext("TXT").first_or_octet_stream().to_string(), - "text/plain".to_string() - ); - assert_eq!( - from_ext("blahblah").first_or_octet_stream().to_string(), - "application/octet-stream".to_string() - ); - - assert_eq!( - from_path(Path::new("/path/to/file.gif")) - .first_or_octet_stream() - .to_string(), - "image/gif".to_string() - ); - assert_eq!( - from_path("/path/to/file.gif") - .first_or_octet_stream() - .to_string(), - "image/gif".to_string() - ); - } - - #[test] - fn test_mime_type_guessing_opt() { - assert_eq!( - from_ext("gif").first().unwrap().to_string(), - "image/gif".to_string() - ); - assert_eq!( - from_ext("TXT").first().unwrap().to_string(), - "text/plain".to_string() - ); - assert_eq!(from_ext("blahblah").first(), None); - - assert_eq!( - from_path("/path/to/file.gif").first().unwrap().to_string(), - "image/gif".to_string() - ); - assert_eq!(from_path("/path/to/file").first(), None); - } - - #[test] - fn test_are_mime_types_parseable() { - for (_, mimes) in MIME_TYPES { - mimes.iter().for_each(|s| { - expect_mime(s); - }); - } - } - - // RFC: Is this test necessary anymore? --@cybergeek94, 2/1/2016 - #[test] - fn test_are_extensions_ascii() { - for (ext, _) in MIME_TYPES { - assert!(ext.is_ascii(), "Extension not ASCII: {:?}", ext); - } - } - - #[test] - fn test_are_extensions_sorted() { - // simultaneously checks the requirement that duplicate extension entries are adjacent - for (&(ext, _), &(n_ext, _)) in MIME_TYPES.iter().zip(MIME_TYPES.iter().skip(1)) { - assert!( - ext <= n_ext, - "Extensions in src/mime_types should be sorted lexicographically - in ascending order. Failed assert: {:?} <= {:?}", - ext, - n_ext - ); - } - } - - #[test] - fn test_get_mime_extensions_str_no_panic_if_bad_mime() { - assert_eq!(get_mime_extensions_str(""), None); - } -} +//! Guessing of MIME types by file extension. +//! +//! Uses a static list of file-extension : MIME type mappings. +//! +//! ``` +//! # extern crate mime; +//! // the file doesn't have to exist, it just looks at the path +//! let guess = mime_guess::from_path("some_file.gif"); +//! assert_eq!(guess.first(), Some(mime::IMAGE_GIF)); +//! +//! ``` +//! +//! #### Note: MIME Types Returned Are Not Stable/Guaranteed +//! The media types returned for a given extension are not considered to be part of the crate's +//! stable API and are often updated in patch
(`x.y.[z + 1]`) releases to be as correct as +//! possible. +//! +//! Additionally, only the extensions of paths/filenames are inspected in order to guess the MIME +//! type. The file that may or may not reside at that path may or may not be a valid file of the +//! returned MIME type. Be wary of unsafe or un-validated assumptions about file structure or +//! length. +pub extern crate mime; +extern crate unicase; + +pub use mime::Mime; + +use std::ffi::OsStr; +use std::iter::FusedIterator; +use std::path::Path; +use std::{iter, slice}; + +#[cfg(feature = "phf")] +#[path = "impl_phf.rs"] +mod impl_; + +#[cfg(not(feature = "phf"))] +#[path = "impl_bin_search.rs"] +mod impl_; + +/// A "guess" of the MIME/Media Type(s) of an extension or path as one or more +/// [`Mime`](struct.Mime.html) instances. +/// +/// ### Note: Ordering +/// A given file format may have one or more applicable Media Types; in this case +/// the first Media Type returned is whatever is declared in the latest IETF RFC for the +/// presumed file format or the one that explicitly supercedes all others. +/// Ordering of additional Media Types is arbitrary. +/// +/// ### Note: Values Not Stable +/// The exact Media Types returned in any given guess are not considered to be stable and are often +/// updated in patch releases in order to reflect the most up-to-date information possible. +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +// FIXME: change repr when `mime` gains macro/const fn constructor +pub struct MimeGuess(&'static [&'static str]); + +impl MimeGuess { + /// Guess the MIME type of a file (real or otherwise) with the given extension. + /// + /// The search is case-insensitive. + /// + /// If `ext` is empty or has no (currently) known MIME type mapping, then an empty guess is + /// returned. + pub fn from_ext(ext: &str) -> MimeGuess { + if ext.is_empty() { + return MimeGuess(&[]); + } + + impl_::get_mime_types(ext).map_or(MimeGuess(&[]), |v| MimeGuess(v)) + } + + /// Guess the MIME type of `path` by its extension (as defined by + /// [`Path::extension()`]). **No disk access is performed.** + /// + /// If `path` has no extension, the extension cannot be converted to `str`, or has + /// no known MIME type mapping, then an empty guess is returned. + /// + /// The search is case-insensitive. + /// + /// ## Note + /// **Guess** is the operative word here, as there are no guarantees that the contents of the + /// file that `path` points to match the MIME type associated with the path's extension. + /// + /// Take care when processing files with assumptions based on the return value of this function. + /// + /// [`Path::extension()`]: https://doc.rust-lang.org/std/path/struct.Path.html#method.extension + pub fn from_path>(path: P) -> MimeGuess { + path.as_ref() + .extension() + .and_then(OsStr::to_str) + .map_or(MimeGuess(&[]), Self::from_ext) + } + + /// `true` if the guess did not return any known mappings for the given path or extension. + pub fn is_empty(&self) -> bool { + self.0.is_empty() + } + + /// Get the number of MIME types in the current guess. + pub fn count(&self) -> usize { + self.0.len() + } + + /// Get the first guessed `Mime`, if applicable. + /// + /// See [Note: Ordering](#note-ordering) above. + pub fn first(&self) -> Option { + self.first_raw().map(expect_mime) + } + + /// Get the first guessed Media Type as a string, if applicable. + /// + /// See [Note: Ordering](#note-ordering) above. + pub fn first_raw(&self) -> Option<&'static str> { + self.0.get(0).cloned() + } + + /// Get the first guessed `Mime`, or if the guess is empty, return + /// [`application/octet-stream`] instead. + /// + /// See [Note: Ordering](#note-ordering) above. + /// + /// ### Note: HTTP Applications + /// For HTTP request and response bodies if a value for the `Content-Type` header + /// cannot be determined it might be preferable to not send one at all instead of defaulting to + /// `application/octet-stream` as the recipient will expect to infer the format directly from + /// the content instead. ([RFC 7231, Section 3.1.1.5][rfc7231]) + /// + /// On the contrary, for `multipart/form-data` bodies, the `Content-Type` of a form-data part is + /// assumed to be `text/plain` unless specified so a default of `application/octet-stream` + /// for non-text parts is safer. ([RFC 7578, Section 4.4][rfc7578]) + /// + /// [`application/octet-stream`]: https://docs.rs/mime/0.3/mime/constant.APPLICATION_OCTET_STREAM.html + /// [rfc7231]: https://tools.ietf.org/html/rfc7231#section-3.1.1.5 + /// [rfc7578]: https://tools.ietf.org/html/rfc7578#section-4.4 + pub fn first_or_octet_stream(&self) -> Mime { + self.first_or(mime::APPLICATION_OCTET_STREAM) + } + + /// Get the first guessed `Mime`, or if the guess is empty, return + /// [`text/plain`](::mime::TEXT_PLAIN) instead. + /// + /// See [Note: Ordering](#note-ordering) above. + pub fn first_or_text_plain(&self) -> Mime { + self.first_or(mime::TEXT_PLAIN) + } + + /// Get the first guessed `Mime`, or if the guess is empty, return the given `Mime` instead. + /// + /// See [Note: Ordering](#note-ordering) above. + pub fn first_or(&self, default: Mime) -> Mime { + self.first().unwrap_or(default) + } + + /// Get the first guessed `Mime`, or if the guess is empty, execute the closure and return its + /// result. + /// + /// See [Note: Ordering](#note-ordering) above. + pub fn first_or_else(&self, default_fn: F) -> Mime + where + F: FnOnce() -> Mime, + { + self.first().unwrap_or_else(default_fn) + } + + /// Get an iterator over the `Mime` values contained in this guess. + /// + /// See [Note: Ordering](#note-ordering) above. + pub fn iter(&self) -> Iter { + Iter(self.iter_raw().map(expect_mime)) + } + + /// Get an iterator over the raw media-type strings in this guess. + /// + /// See [Note: Ordering](#note-ordering) above. + pub fn iter_raw(&self) -> IterRaw { + IterRaw(self.0.iter().cloned()) + } +} + +impl IntoIterator for MimeGuess { + type Item = Mime; + type IntoIter = Iter; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + +impl<'a> IntoIterator for &'a MimeGuess { + type Item = Mime; + type IntoIter = Iter; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + +/// An iterator over the `Mime` types of a `MimeGuess`. +/// +/// See [Note: Ordering on `MimeGuess`](struct.MimeGuess.html#note-ordering). +#[derive(Clone, Debug)] +pub struct Iter(iter::Map Mime>); + +impl Iterator for Iter { + type Item = Mime; + + fn next(&mut self) -> Option { + self.0.next() + } + + fn size_hint(&self) -> (usize, Option) { + self.0.size_hint() + } +} + +impl DoubleEndedIterator for Iter { + fn next_back(&mut self) -> Option { + self.0.next_back() + } +} + +impl FusedIterator for Iter {} + +impl ExactSizeIterator for Iter { + fn len(&self) -> usize { + self.0.len() + } +} + +/// An iterator over the raw media type strings of a `MimeGuess`. +/// +/// See [Note: Ordering on `MimeGuess`](struct.MimeGuess.html#note-ordering). +#[derive(Clone, Debug)] +pub struct IterRaw(iter::Cloned>); + +impl Iterator for IterRaw { + type Item = &'static str; + + fn next(&mut self) -> Option { + self.0.next() + } + + fn size_hint(&self) -> (usize, Option) { + self.0.size_hint() + } +} + +impl DoubleEndedIterator for IterRaw { + fn next_back(&mut self) -> Option { + self.0.next_back() + } +} + +impl FusedIterator for IterRaw {} + +impl ExactSizeIterator for IterRaw { + fn len(&self) -> usize { + self.0.len() + } +} + +fn expect_mime(s: &str) -> Mime { + // `.parse()` should be checked at compile time to never fail + s.parse() + .unwrap_or_else(|e| panic!("failed to parse media-type {:?}: {}", s, e)) +} + +/// Wrapper of [`MimeGuess::from_ext()`](struct.MimeGuess.html#method.from_ext). +pub fn from_ext(ext: &str) -> MimeGuess { + MimeGuess::from_ext(ext) +} + +/// Wrapper of [`MimeGuess::from_path()`](struct.MimeGuess.html#method.from_path). +pub fn from_path>(path: P) -> MimeGuess { + MimeGuess::from_path(path) +} + +/// Guess the MIME type of `path` by its extension (as defined by `Path::extension()`). +/// +/// If `path` has no extension, or its extension has no known MIME type mapping, +/// then the MIME type is assumed to be `application/octet-stream`. +/// +/// ## Note +/// **Guess** is the operative word here, as there are no guarantees that the contents of the file +/// that `path` points to match the MIME type associated with the path's extension. +/// +/// Take care when processing files with assumptions based on the return value of this function. +/// +/// In HTTP applications, it might be [preferable][rfc7231] to not send a `Content-Type` +/// header at all instead of defaulting to `application/octet-stream`. +/// +/// [rfc7231]: https://tools.ietf.org/html/rfc7231#section-3.1.1.5 +#[deprecated( + since = "2.0.0", + note = "Use `from_path(path).first_or_octet_stream()` instead" +)] +pub fn guess_mime_type>(path: P) -> Mime { + from_path(path).first_or_octet_stream() +} + +/// Guess the MIME type of `path` by its extension (as defined by `Path::extension()`). +/// +/// If `path` has no extension, or its extension has no known MIME type mapping, +/// then `None` is returned. +/// +#[deprecated(since = "2.0.0", note = "Use `from_path(path).first()` instead")] +pub fn guess_mime_type_opt>(path: P) -> Option { + from_path(path).first() +} + +/// Guess the MIME type string of `path` by its extension (as defined by `Path::extension()`). +/// +/// If `path` has no extension, or its extension has no known MIME type mapping, +/// then `None` is returned. +/// +/// ## Note +/// **Guess** is the operative word here, as there are no guarantees that the contents of the file +/// that `path` points to match the MIME type associated with the path's extension. +/// +/// Take care when processing files with assumptions based on the return value of this function. +#[deprecated(since = "2.0.0", note = "Use `from_path(path).first_raw()` instead")] +pub fn mime_str_for_path_ext>(path: P) -> Option<&'static str> { + from_path(path).first_raw() +} + +/// Get the MIME type associated with a file extension. +/// +/// If there is no association for the extension, or `ext` is empty, +/// `application/octet-stream` is returned. +/// +/// ## Note +/// In HTTP applications, it might be [preferable][rfc7231] to not send a `Content-Type` +/// header at all instead of defaulting to `application/octet-stream`. +/// +/// [rfc7231]: https://tools.ietf.org/html/rfc7231#section-3.1.1.5 +#[deprecated( + since = "2.0.0", + note = "use `from_ext(search_ext).first_or_octet_stream()` instead" +)] +pub fn get_mime_type(search_ext: &str) -> Mime { + from_ext(search_ext).first_or_octet_stream() +} + +/// Get the MIME type associated with a file extension. +/// +/// If there is no association for the extension, or `ext` is empty, +/// `None` is returned. +#[deprecated(since = "2.0.0", note = "use `from_ext(search_ext).first()` instead")] +pub fn get_mime_type_opt(search_ext: &str) -> Option { + from_ext(search_ext).first() +} + +/// Get the MIME type string associated with a file extension. Case-insensitive. +/// +/// If `search_ext` is not already lowercase, +/// it will be converted to lowercase to facilitate the search. +/// +/// Returns `None` if `search_ext` is empty or an associated extension was not found. +#[deprecated( + since = "2.0.0", + note = "use `from_ext(search_ext).first_raw()` instead" +)] +pub fn get_mime_type_str(search_ext: &str) -> Option<&'static str> { + from_ext(search_ext).first_raw() +} + +/// Get a list of known extensions for a given `Mime`. +/// +/// Ignores parameters (only searches with `
/`). Case-insensitive (for extension types). +/// +/// Returns `None` if the MIME type is unknown. +/// +/// ### Wildcards +/// If the top-level of the MIME type is a wildcard (`*`), returns all extensions. +/// +/// If the sub-level of the MIME type is a wildcard, returns all extensions for the top-level. +#[cfg(feature = "rev-mappings")] +pub fn get_mime_extensions(mime: &Mime) -> Option<&'static [&'static str]> { + get_extensions(mime.type_().as_ref(), mime.subtype().as_ref()) +} + +/// Get a list of known extensions for a MIME type string. +/// +/// Ignores parameters (only searches `
/`). Case-insensitive. +/// +/// Returns `None` if the MIME type is unknown. +/// +/// ### Wildcards +/// If the top-level of the MIME type is a wildcard (`*`), returns all extensions. +/// +/// If the sub-level of the MIME type is a wildcard, returns all extensions for the top-level. +/// +/// ### Panics +/// If `mime_str` is not a valid MIME type specifier (naive). +#[cfg(feature = "rev-mappings")] +pub fn get_mime_extensions_str(mut mime_str: &str) -> Option<&'static [&'static str]> { + mime_str = mime_str.trim(); + + if let Some(sep_idx) = mime_str.find(';') { + mime_str = &mime_str[..sep_idx]; + } + + let (top, sub) = { + let split_idx = mime_str.find('/')?; + (&mime_str[..split_idx], &mime_str[split_idx + 1..]) + }; + + get_extensions(top, sub) +} + +/// Get the extensions for a given top-level and sub-level of a MIME type +/// (`{toplevel}/{sublevel}`). +/// +/// Returns `None` if `toplevel` or `sublevel` are unknown. +/// +/// ### Wildcards +/// If the top-level of the MIME type is a wildcard (`*`), returns all extensions. +/// +/// If the sub-level of the MIME type is a wildcard, returns all extensions for the top-level. +#[cfg(feature = "rev-mappings")] +pub fn get_extensions(toplevel: &str, sublevel: &str) -> Option<&'static [&'static str]> { + impl_::get_extensions(toplevel, sublevel) +} + +/// Get the MIME type for `application/octet-stream` (generic binary stream) +#[deprecated(since = "2.0.0", note = "use `mime::APPLICATION_OCTET_STREAM` instead")] +pub fn octet_stream() -> Mime { + "application/octet-stream".parse().unwrap() +} + +#[cfg(test)] +mod tests { + include!("mime_types.rs"); + + use super::{expect_mime, from_ext, from_path, get_mime_extensions_str}; + #[allow(deprecated, unused_imports)] + use std::ascii::AsciiExt; + + use std::fmt::Debug; + use std::path::Path; + + #[test] + fn check_type_bounds() { + fn assert_type_bounds() {} + + assert_type_bounds::(); + assert_type_bounds::(); + assert_type_bounds::(); + } + + #[test] + fn test_mime_type_guessing() { + assert_eq!( + from_ext("gif").first_or_octet_stream().to_string(), + "image/gif".to_string() + ); + assert_eq!( + from_ext("TXT").first_or_octet_stream().to_string(), + "text/plain".to_string() + ); + assert_eq!( + from_ext("blahblah").first_or_octet_stream().to_string(), + "application/octet-stream".to_string() + ); + + assert_eq!( + from_path(Path::new("/path/to/file.gif")) + .first_or_octet_stream() + .to_string(), + "image/gif".to_string() + ); + assert_eq!( + from_path("/path/to/file.gif") + .first_or_octet_stream() + .to_string(), + "image/gif".to_string() + ); + } + + #[test] + fn test_mime_type_guessing_opt() { + assert_eq!( + from_ext("gif").first().unwrap().to_string(), + "image/gif".to_string() + ); + assert_eq!( + from_ext("TXT").first().unwrap().to_string(), + "text/plain".to_string() + ); + assert_eq!(from_ext("blahblah").first(), None); + + assert_eq!( + from_path("/path/to/file.gif").first().unwrap().to_string(), + "image/gif".to_string() + ); + assert_eq!(from_path("/path/to/file").first(), None); + } + + #[test] + fn test_are_mime_types_parseable() { + for (_, mimes) in MIME_TYPES { + mimes.iter().for_each(|s| { + expect_mime(s); + }); + } + } + + // RFC: Is this test necessary anymore? --@cybergeek94, 2/1/2016 + #[test] + fn test_are_extensions_ascii() { + for (ext, _) in MIME_TYPES { + assert!(ext.is_ascii(), "Extension not ASCII: {:?}", ext); + } + } + + #[test] + fn test_are_extensions_sorted() { + // simultaneously checks the requirement that duplicate extension entries are adjacent + for (&(ext, _), &(n_ext, _)) in MIME_TYPES.iter().zip(MIME_TYPES.iter().skip(1)) { + assert!( + ext <= n_ext, + "Extensions in src/mime_types should be sorted lexicographically + in ascending order. Failed assert: {:?} <= {:?}", + ext, + n_ext + ); + } + } + + #[test] + fn test_get_mime_extensions_str_no_panic_if_bad_mime() { + assert_eq!(get_mime_extensions_str(""), None); + } +} diff --git a/third_party/rust/mime_guess/src/mime_types.rs b/third_party/rust/mime_guess/src/mime_types.rs index 13c91b7bee77..e49d76474645 100644 --- a/third_party/rust/mime_guess/src/mime_types.rs +++ b/third_party/rust/mime_guess/src/mime_types.rs @@ -1,1499 +1,1534 @@ -/// A mapping of known file extensions and their MIME types. -/// -/// Required to be sorted lexicographically by extension for ease of maintenance. -/// -/// Multiple MIME types per extension are supported; the order is arbitrary but the first should be -/// the most prevalent by most recent RFC declaration or explicit succession of other media types. -/// -/// NOTE: when adding or modifying entries, please include a citation in the commit message. -/// If a media type for an extension changed by official IETF RFC, please keep the old entry but add -/// the new one before it in the slice literal, e.g.: -/// -/// ```ignore -/// - ("md", &["text/x-markdown"]), -/// + ("md", &["text/markdown", "text/x-markdown"]), -/// ``` -/// -/// Sourced from: -/// https://github.com/samuelneff/MimeTypeMap/blob/master/src/MimeTypes/MimeTypeMap.cs -/// https://github.com/jshttp/mime-db extracted with https://gist.github.com/soyuka/b7e29d359b2c14c21bdead923c01cc81 -pub static MIME_TYPES: &[(&str, &[&str])] = &[ - ("123", &["application/vnd.lotus-1-2-3"]), - ("323", &["text/h323"]), - ("3dml", &["text/vnd.in3d.3dml"]), - ("3ds", &["image/x-3ds"]), - ("3g2", &["video/3gpp2"]), - ("3gp", &["video/3gpp"]), - ("3gp2", &["video/3gpp2"]), - ("3gpp", &["video/3gpp"]), - ("7z", &["application/x-7z-compressed"]), - ("aa", &["audio/audible"]), - ("aab", &["application/x-authorware-bin"]), - ("aac", &["audio/aac"]), - ("aaf", &["application/octet-stream"]), - ("aam", &["application/x-authorware-map"]), - ("aas", &["application/x-authorware-seg"]), - ("aax", &["audio/vnd.audible.aax"]), - ("abw", &["application/x-abiword"]), - ("ac", &["application/pkix-attr-cert"]), - ("ac3", &["audio/ac3"]), - ("aca", &["application/octet-stream"]), - ("acc", &["application/vnd.americandynamics.acc"]), - ("accda", &["application/msaccess.addin"]), - ("accdb", &["application/msaccess"]), - ("accdc", &["application/msaccess.cab"]), - ("accde", &["application/msaccess"]), - ("accdr", &["application/msaccess.runtime"]), - ("accdt", &["application/msaccess"]), - ("accdw", &["application/msaccess.webapplication"]), - ("accft", &["application/msaccess.ftemplate"]), - ("ace", &["application/x-ace-compressed"]), - ("acu", &["application/vnd.acucobol"]), - ("acutc", &["application/vnd.acucorp"]), - ("acx", &["application/internet-property-stream"]), - ("addin", &["text/xml"]), - ("ade", &["application/msaccess"]), - ("adobebridge", &["application/x-bridge-url"]), - ("adp", &["application/msaccess"]), - ("adt", &["audio/vnd.dlna.adts"]), - ("adts", &["audio/aac"]), - ("aep", &["application/vnd.audiograph"]), - ("afm", &["application/octet-stream"]), - ("afp", &["application/vnd.ibm.modcap"]), - ("ahead", &["application/vnd.ahead.space"]), - ("ai", &["application/postscript"]), - ("aif", &["audio/aiff"]), - ("aifc", &["audio/aiff"]), - ("aiff", &["audio/aiff"]), - ( - "air", - &["application/vnd.adobe.air-application-installer-package+zip"], - ), - ("ait", &["application/vnd.dvb.ait"]), - ("amc", &["application/mpeg"]), - ("ami", &["application/vnd.amiga.ami"]), - ("anx", &["application/annodex"]), - ("apk", &["application/vnd.android.package-archive"]), - ("apng", &["image/apng"]), - ("appcache", &["text/cache-manifest"]), - ("application", &["application/x-ms-application"]), - ("apr", &["application/vnd.lotus-approach"]), - ("arc", &["application/x-freearc"]), - ("arj", &["application/x-arj"]), - ("art", &["image/x-jg"]), - ("asa", &["application/xml"]), - ("asax", &["application/xml"]), - ("asc", &["application/pgp-signature"]), - ("ascx", &["application/xml"]), - ("asd", &["application/octet-stream"]), - ("asf", &["video/x-ms-asf"]), - ("ashx", &["application/xml"]), - ("asi", &["application/octet-stream"]), - ("asm", &["text/plain"]), - ("asmx", &["application/xml"]), - ("aso", &["application/vnd.accpac.simply.aso"]), - ("aspx", &["application/xml"]), - ("asr", &["video/x-ms-asf"]), - ("asx", &["video/x-ms-asf"]), - ("atc", &["application/vnd.acucorp"]), - ("atom", &["application/atom+xml"]), - ("atomcat", &["application/atomcat+xml"]), - ("atomsvc", &["application/atomsvc+xml"]), - ("atx", &["application/vnd.antix.game-component"]), - ("au", &["audio/basic"]), - ("avi", &["video/x-msvideo"]), - ("avif", &["image/avif"]), - ("aw", &["application/applixware"]), - ("axa", &["audio/annodex"]), - ("axs", &["application/olescript"]), - ("axv", &["video/annodex"]), - ("azf", &["application/vnd.airzip.filesecure.azf"]), - ("azs", &["application/vnd.airzip.filesecure.azs"]), - ("azw", &["application/vnd.amazon.ebook"]), - ("bas", &["text/plain"]), - ("bat", &["application/x-msdownload"]), - ("bcpio", &["application/x-bcpio"]), - ("bdf", &["application/x-font-bdf"]), - ("bdm", &["application/vnd.syncml.dm+wbxml"]), - ("bdoc", &["application/bdoc"]), - ("bed", &["application/vnd.realvnc.bed"]), - ("bh2", &["application/vnd.fujitsu.oasysprs"]), - ("bin", &["application/octet-stream"]), - ("blb", &["application/x-blorb"]), - ("blorb", &["application/x-blorb"]), - ("bmi", &["application/vnd.bmi"]), - ("bmp", &["image/bmp"]), - ("book", &["application/vnd.framemaker"]), - ("box", &["application/vnd.previewsystems.box"]), - ("boz", &["application/x-bzip2"]), - ("bpk", &["application/octet-stream"]), - ("btif", &["image/prs.btif"]), - ("buffer", &["application/octet-stream"]), - ("bz", &["application/x-bzip"]), - ("bz2", &["application/x-bzip2"]), - ("c", &["text/plain"]), - ("c11amc", &["application/vnd.cluetrust.cartomobile-config"]), - ( - "c11amz", - &["application/vnd.cluetrust.cartomobile-config-pkg"], - ), - ("c4d", &["application/vnd.clonk.c4group"]), - ("c4f", &["application/vnd.clonk.c4group"]), - ("c4g", &["application/vnd.clonk.c4group"]), - ("c4p", &["application/vnd.clonk.c4group"]), - ("c4u", &["application/vnd.clonk.c4group"]), - ("cab", &["application/octet-stream"]), - ("caf", &["audio/x-caf"]), - ("calx", &["application/vnd.ms-office.calx"]), - ("cap", &["application/vnd.tcpdump.pcap"]), - ("car", &["application/vnd.curl.car"]), - ("cat", &["application/vnd.ms-pki.seccat"]), - ("cb7", &["application/x-cbr"]), - ("cba", &["application/x-cbr"]), - ("cbr", &["application/x-cbr"]), - ("cbt", &["application/x-cbr"]), - ("cbz", &["application/x-cbr"]), - ("cc", &["text/plain"]), - ("cco", &["application/x-cocoa"]), - ("cct", &["application/x-director"]), - ("ccxml", &["application/ccxml+xml"]), - ("cd", &["text/plain"]), - ("cdbcmsg", &["application/vnd.contact.cmsg"]), - ("cdda", &["audio/aiff"]), - ("cdf", &["application/x-cdf"]), - ("cdkey", &["application/vnd.mediastation.cdkey"]), - ("cdmia", &["application/cdmi-capability"]), - ("cdmic", &["application/cdmi-container"]), - ("cdmid", &["application/cdmi-domain"]), - ("cdmio", &["application/cdmi-object"]), - ("cdmiq", &["application/cdmi-queue"]), - ("cdx", &["chemical/x-cdx"]), - ("cdxml", &["application/vnd.chemdraw+xml"]), - ("cdy", &["application/vnd.cinderella"]), - ("cer", &["application/x-x509-ca-cert"]), - ("cfg", &["text/plain"]), - ("cfs", &["application/x-cfs-compressed"]), - ("cgm", &["image/cgm"]), - ("chat", &["application/x-chat"]), - ("chm", &["application/vnd.ms-htmlhelp"]), - ("chrt", &["application/vnd.kde.kchart"]), - ("cif", &["chemical/x-cif"]), - ( - "cii", - &["application/vnd.anser-web-certificate-issue-initiation"], - ), - ("cil", &["application/vnd.ms-artgalry"]), - ("cla", &["application/vnd.claymore"]), - ("class", &["application/x-java-applet"]), - ("clkk", &["application/vnd.crick.clicker.keyboard"]), - ("clkp", &["application/vnd.crick.clicker.palette"]), - ("clkt", &["application/vnd.crick.clicker.template"]), - ("clkw", &["application/vnd.crick.clicker.wordbank"]), - ("clkx", &["application/vnd.crick.clicker"]), - ("clp", &["application/x-msclip"]), - ("cmc", &["application/vnd.cosmocaller"]), - ("cmd", &["text/plain"]), - ("cmdf", &["chemical/x-cmdf"]), - ("cml", &["chemical/x-cml"]), - ("cmp", &["application/vnd.yellowriver-custom-menu"]), - ("cmx", &["image/x-cmx"]), - ("cnf", &["text/plain"]), - ("cod", &["image/cis-cod"]), - ("coffee", &["text/coffeescript"]), - ("com", &["application/x-msdownload"]), - ("conf", &["text/plain"]), - ("config", &["application/xml"]), - ("contact", &["text/x-ms-contact"]), - ("coverage", &["application/xml"]), - ("cpio", &["application/x-cpio"]), - ("cpp", &["text/plain"]), - ("cpt", &["application/mac-compactpro"]), - ("crd", &["application/x-mscardfile"]), - ("crl", &["application/pkix-crl"]), - ("crt", &["application/x-x509-ca-cert"]), - ("crx", &["application/x-chrome-extension"]), - ("cryptonote", &["application/vnd.rig.cryptonote"]), - ("cs", &["text/plain"]), - ("csdproj", &["text/plain"]), - ("csh", &["application/x-csh"]), - ("csl", &["application/vnd.citationstyles.style+xml"]), - ("csml", &["chemical/x-csml"]), - ("csp", &["application/vnd.commonspace"]), - ("csproj", &["text/plain"]), - ("css", &["text/css"]), - ("cst", &["application/x-director"]), - ("csv", &["text/csv"]), - ("cu", &["application/cu-seeme"]), - ("cur", &["application/octet-stream"]), - ("curl", &["text/vnd.curl"]), - ("cww", &["application/prs.cww"]), - ("cxt", &["application/x-director"]), - ("cxx", &["text/plain"]), - ("dae", &["model/vnd.collada+xml"]), - ("daf", &["application/vnd.mobius.daf"]), - ("dart", &["application/vnd.dart"]), - ("dat", &["application/octet-stream"]), - ("dataless", &["application/vnd.fdsn.seed"]), - ("datasource", &["application/xml"]), - ("davmount", &["application/davmount+xml"]), - ("dbk", &["application/docbook+xml"]), - ("dbproj", &["text/plain"]), - ("dcr", &["application/x-director"]), - ("dcurl", &["text/vnd.curl.dcurl"]), - ("dd2", &["application/vnd.oma.dd2+xml"]), - ("ddd", &["application/vnd.fujixerox.ddd"]), - ("deb", &["application/octet-stream"]), - ("def", &["text/plain"]), - ("deploy", &["application/octet-stream"]), - ("der", &["application/x-x509-ca-cert"]), - ("dfac", &["application/vnd.dreamfactory"]), - ("dgc", &["application/x-dgc-compressed"]), - ("dgml", &["application/xml"]), - ("dib", &["image/bmp"]), - ("dic", &["text/x-c"]), - ("dif", &["video/x-dv"]), - ("dir", &["application/x-director"]), - ("dis", &["application/vnd.mobius.dis"]), - ("disco", &["text/xml"]), - ( - "disposition-notification", - &["message/disposition-notification"], - ), - ("dist", &["application/octet-stream"]), - ("distz", &["application/octet-stream"]), - ("divx", &["video/divx"]), - ("djv", &["image/vnd.djvu"]), - ("djvu", &["image/vnd.djvu"]), - ("dll", &["application/x-msdownload"]), - ("dll.config", &["text/xml"]), - ("dlm", &["text/dlm"]), - ("dmg", &["application/octet-stream"]), - ("dmp", &["application/vnd.tcpdump.pcap"]), - ("dms", &["application/octet-stream"]), - ("dna", &["application/vnd.dna"]), - ("doc", &["application/msword"]), - ( - "docm", - &["application/vnd.ms-word.document.macroEnabled.12"], - ), - ( - "docx", - &["application/vnd.openxmlformats-officedocument.wordprocessingml.document"], - ), - ("dot", &["application/msword"]), - ( - "dotm", - &["application/vnd.ms-word.template.macroEnabled.12"], - ), - ( - "dotx", - &["application/vnd.openxmlformats-officedocument.wordprocessingml.template"], - ), - ("dp", &["application/vnd.osgi.dp"]), - ("dpg", &["application/vnd.dpgraph"]), - ("dra", &["audio/vnd.dra"]), - ("dsc", &["text/prs.lines.tag"]), - ("dsp", &["application/octet-stream"]), - ("dssc", &["application/dssc+der"]), - ("dsw", &["text/plain"]), - ("dtb", &["application/x-dtbook+xml"]), - ("dtd", &["text/xml"]), - ("dts", &["audio/vnd.dts"]), - ("dtsconfig", &["text/xml"]), - ("dtshd", &["audio/vnd.dts.hd"]), - ("dump", &["application/octet-stream"]), - ("dv", &["video/x-dv"]), - ("dvb", &["video/vnd.dvb.file"]), - ("dvi", &["application/x-dvi"]), - ("dwf", &["drawing/x-dwf"]), - ("dwg", &["application/acad"]), - ("dwp", &["application/octet-stream"]), - ("dxf", &["application/x-dxf"]), - ("dxp", &["application/vnd.spotfire.dxp"]), - ("dxr", &["application/x-director"]), - ("ear", &["application/java-archive"]), - ("ecelp4800", &["audio/vnd.nuera.ecelp4800"]), - ("ecelp7470", &["audio/vnd.nuera.ecelp7470"]), - ("ecelp9600", &["audio/vnd.nuera.ecelp9600"]), - ("ecma", &["application/ecmascript"]), - ("edm", &["application/vnd.novadigm.edm"]), - ("edx", &["application/vnd.novadigm.edx"]), - ("efif", &["application/vnd.picsel"]), - ("ei6", &["application/vnd.pg.osasli"]), - ("elc", &["application/octet-stream"]), - ("emf", &["application/x-msmetafile"]), - ("eml", &["message/rfc822"]), - ("emma", &["application/emma+xml"]), - ("emz", &["application/octet-stream"]), - ("eol", &["audio/vnd.digital-winds"]), - ("eot", &["application/vnd.ms-fontobject"]), - ("eps", &["application/postscript"]), - ("epub", &["application/epub+zip"]), - ("es", &["application/ecmascript"]), - ("es3", &["application/vnd.eszigno3+xml"]), - ("esa", &["application/vnd.osgi.subsystem"]), - ("esf", &["application/vnd.epson.esf"]), - ("et3", &["application/vnd.eszigno3+xml"]), - ("etl", &["application/etl"]), - ("etx", &["text/x-setext"]), - ("eva", &["application/x-eva"]), - ("evy", &["application/envoy"]), - ("exe", &["application/octet-stream"]), - ("exe.config", &["text/xml"]), - ("exi", &["application/exi"]), - ("ext", &["application/vnd.novadigm.ext"]), - ("ez", &["application/andrew-inset"]), - ("ez2", &["application/vnd.ezpix-album"]), - ("ez3", &["application/vnd.ezpix-package"]), - ("f", &["text/x-fortran"]), - ("f4v", &["video/x-f4v"]), - ("f77", &["text/x-fortran"]), - ("f90", &["text/x-fortran"]), - ("fbs", &["image/vnd.fastbidsheet"]), - ("fcdt", &["application/vnd.adobe.formscentral.fcdt"]), - ("fcs", &["application/vnd.isac.fcs"]), - ("fdf", &["application/vnd.fdf"]), - ("fe_launch", &["application/vnd.denovo.fcselayout-link"]), - ("feature", &["text/x-gherkin"]), - ("fg5", &["application/vnd.fujitsu.oasysgp"]), - ("fgd", &["application/x-director"]), - ("fh", &["image/x-freehand"]), - ("fh4", &["image/x-freehand"]), - ("fh5", &["image/x-freehand"]), - ("fh7", &["image/x-freehand"]), - ("fhc", &["image/x-freehand"]), - ("fif", &["application/fractals"]), - ("fig", &["application/x-xfig"]), - ("filters", &["application/xml"]), - ("fla", &["application/octet-stream"]), - ("flac", &["audio/flac"]), - ("fli", &["video/x-fli"]), - ("flo", &["application/vnd.micrografx.flo"]), - ("flr", &["x-world/x-vrml"]), - ("flv", &["video/x-flv"]), - ("flw", &["application/vnd.kde.kivio"]), - ("flx", &["text/vnd.fmi.flexstor"]), - ("fly", &["text/vnd.fly"]), - ("fm", &["application/vnd.framemaker"]), - ("fnc", &["application/vnd.frogans.fnc"]), - ("for", &["text/x-fortran"]), - ("fpx", &["image/vnd.fpx"]), - ("frame", &["application/vnd.framemaker"]), - ("fsc", &["application/vnd.fsc.weblaunch"]), - ("fsscript", &["application/fsharp-script"]), - ("fst", &["image/vnd.fst"]), - ("fsx", &["application/fsharp-script"]), - ("ftc", &["application/vnd.fluxtime.clip"]), - ( - "fti", - &["application/vnd.anser-web-funds-transfer-initiation"], - ), - ("fvt", &["video/vnd.fvt"]), - ("fxp", &["application/vnd.adobe.fxp"]), - ("fxpl", &["application/vnd.adobe.fxp"]), - ("fzs", &["application/vnd.fuzzysheet"]), - ("g2w", &["application/vnd.geoplan"]), - ("g3", &["image/g3fax"]), - ("g3w", &["application/vnd.geospace"]), - ("gac", &["application/vnd.groove-account"]), - ("gam", &["application/x-tads"]), - ("gbr", &["application/rpki-ghostbusters"]), - ("gca", &["application/x-gca-compressed"]), - ("gdl", &["model/vnd.gdl"]), - ("gdoc", &["application/vnd.google-apps.document"]), - ("gemini", &["text/gemini"]), - ("generictest", &["application/xml"]), - ("geo", &["application/vnd.dynageo"]), - ("geojson", &["application/geo+json"]), - ("gex", &["application/vnd.geometry-explorer"]), - ("ggb", &["application/vnd.geogebra.file"]), - ("ggt", &["application/vnd.geogebra.tool"]), - ("ghf", &["application/vnd.groove-help"]), - ("gif", &["image/gif"]), - ("gim", &["application/vnd.groove-identity-message"]), - ("glb", &["model/gltf-binary"]), - ("gltf", &["model/gltf+json"]), - ("gmi", &["text/gemini"]), - ("gml", &["application/gml+xml"]), - ("gmx", &["application/vnd.gmx"]), - ("gnumeric", &["application/x-gnumeric"]), - ("gph", &["application/vnd.flographit"]), - ("gpx", &["application/gpx+xml"]), - ("gqf", &["application/vnd.grafeq"]), - ("gqs", &["application/vnd.grafeq"]), - ("gram", &["application/srgs"]), - ("gramps", &["application/x-gramps-xml"]), - ("gre", &["application/vnd.geometry-explorer"]), - ("group", &["text/x-ms-group"]), - ("grv", &["application/vnd.groove-injector"]), - ("grxml", &["application/srgs+xml"]), - ("gsf", &["application/x-font-ghostscript"]), - ("gsheet", &["application/vnd.google-apps.spreadsheet"]), - ("gslides", &["application/vnd.google-apps.presentation"]), - ("gsm", &["audio/x-gsm"]), - ("gtar", &["application/x-gtar"]), - ("gtm", &["application/vnd.groove-tool-message"]), - ("gtw", &["model/vnd.gtw"]), - ("gv", &["text/vnd.graphviz"]), - ("gxf", &["application/gxf"]), - ("gxt", &["application/vnd.geonext"]), - ("gz", &["application/gzip"]), - ("h", &["text/plain"]), - ("h261", &["video/h261"]), - ("h263", &["video/h263"]), - ("h264", &["video/h264"]), - ("hal", &["application/vnd.hal+xml"]), - ("hbci", &["application/vnd.hbci"]), - ("hbs", &["text/x-handlebars-template"]), - ("hdd", &["application/x-virtualbox-hdd"]), - ("hdf", &["application/x-hdf"]), - ("hdml", &["text/x-hdml"]), - ("hdr", &["image/vnd.radiance"]), - ("hh", &["text/plain"]), - ("hhc", &["application/x-oleobject"]), - ("hhk", &["application/octet-stream"]), - ("hhp", &["application/octet-stream"]), - ("hjson", &["application/hjson"]), - ("hlp", &["application/winhlp"]), - ("hpgl", &["application/vnd.hp-hpgl"]), - ("hpid", &["application/vnd.hp-hpid"]), - ("hpp", &["text/plain"]), - ("hps", &["application/vnd.hp-hps"]), - ("hqx", &["application/mac-binhex40"]), - ("hta", &["application/hta"]), - ("htc", &["text/x-component"]), - ("htke", &["application/vnd.kenameaapp"]), - ("htm", &["text/html"]), - ("html", &["text/html"]), - ("htt", &["text/webviewhtml"]), - ("hvd", &["application/vnd.yamaha.hv-dic"]), - ("hvp", &["application/vnd.yamaha.hv-voice"]), - ("hvs", &["application/vnd.yamaha.hv-script"]), - ("hxa", &["application/xml"]), - ("hxc", &["application/xml"]), - ("hxd", &["application/octet-stream"]), - ("hxe", &["application/xml"]), - ("hxf", &["application/xml"]), - ("hxh", &["application/octet-stream"]), - ("hxi", &["application/octet-stream"]), - ("hxk", &["application/xml"]), - ("hxq", &["application/octet-stream"]), - ("hxr", &["application/octet-stream"]), - ("hxs", &["application/octet-stream"]), - ("hxt", &["text/html"]), - ("hxv", &["application/xml"]), - ("hxw", &["application/octet-stream"]), - ("hxx", &["text/plain"]), - ("i", &["text/plain"]), - ("i2g", &["application/vnd.intergeo"]), - ("icc", &["application/vnd.iccprofile"]), - ("ice", &["x-conference/x-cooltalk"]), - ("icm", &["application/vnd.iccprofile"]), - ("ico", &["image/x-icon"]), - ("ics", &["application/octet-stream"]), - ("idl", &["text/plain"]), - ("ief", &["image/ief"]), - ("ifb", &["text/calendar"]), - ("ifm", &["application/vnd.shana.informed.formdata"]), - ("iges", &["model/iges"]), - ("igl", &["application/vnd.igloader"]), - ("igm", &["application/vnd.insors.igm"]), - ("igs", &["model/iges"]), - ("igx", &["application/vnd.micrografx.igx"]), - ("iif", &["application/vnd.shana.informed.interchange"]), - ("iii", &["application/x-iphone"]), - ("img", &["application/octet-stream"]), - ("imp", &["application/vnd.accpac.simply.imp"]), - ("ims", &["application/vnd.ms-ims"]), - ("in", &["text/plain"]), - ("inc", &["text/plain"]), - ("inf", &["application/octet-stream"]), - ("ini", &["text/plain"]), - ("ink", &["application/inkml+xml"]), - ("inkml", &["application/inkml+xml"]), - ("inl", &["text/plain"]), - ("ins", &["application/x-internet-signup"]), - ("install", &["application/x-install-instructions"]), - ("iota", &["application/vnd.astraea-software.iota"]), - ("ipa", &["application/x-itunes-ipa"]), - ("ipfix", &["application/ipfix"]), - ("ipg", &["application/x-itunes-ipg"]), - ("ipk", &["application/vnd.shana.informed.package"]), - ("ipproj", &["text/plain"]), - ("ipsw", &["application/x-itunes-ipsw"]), - ("iqy", &["text/x-ms-iqy"]), - ("irm", &["application/vnd.ibm.rights-management"]), - ("irp", &["application/vnd.irepository.package+xml"]), - ("iso", &["application/octet-stream"]), - ("isp", &["application/x-internet-signup"]), - ("ite", &["application/x-itunes-ite"]), - ("itlp", &["application/x-itunes-itlp"]), - ("itms", &["application/x-itunes-itms"]), - ("itp", &["application/vnd.shana.informed.formtemplate"]), - ("itpc", &["application/x-itunes-itpc"]), - ("ivf", &["video/x-ivf"]), - ("ivp", &["application/vnd.immervision-ivp"]), - ("ivu", &["application/vnd.immervision-ivu"]), - ("jad", &["text/vnd.sun.j2me.app-descriptor"]), - ("jade", &["text/jade"]), - ("jam", &["application/vnd.jam"]), - ("jar", &["application/java-archive"]), - ("jardiff", &["application/x-java-archive-diff"]), - ("java", &["application/octet-stream"]), - ("jck", &["application/liquidmotion"]), - ("jcz", &["application/liquidmotion"]), - ("jfif", &["image/pjpeg"]), - ("jisp", &["application/vnd.jisp"]), - ("jlt", &["application/vnd.hp-jlyt"]), - ("jng", &["image/x-jng"]), - ("jnlp", &["application/x-java-jnlp-file"]), - ("joda", &["application/vnd.joost.joda-archive"]), - ("jp2", &["image/jp2"]), - ("jpb", &["application/octet-stream"]), - ("jpe", &["image/jpeg"]), - ("jpeg", &["image/jpeg"]), - ("jpf", &["image/jpx"]), - ("jpg", &["image/jpeg"]), - ("jpg2", &["image/jp2"]), - ("jpgm", &["video/jpm"]), - ("jpgv", &["video/jpeg"]), - ("jpm", &["image/jpm"]), - ("jpx", &["image/jpx"]), - ("js", &["application/javascript"]), - ("jsm", &["application/javascript"]), - ("json", &["application/json"]), - ("json5", &["application/json5"]), - ("jsonld", &["application/ld+json"]), - ("jsonml", &["application/jsonml+json"]), - ("jsx", &["text/jscript"]), - ("jsxbin", &["text/plain"]), - ("kar", &["audio/midi"]), - ("karbon", &["application/vnd.kde.karbon"]), - ("kfo", &["application/vnd.kde.kformula"]), - ("kia", &["application/vnd.kidspiration"]), - ("kml", &["application/vnd.google-earth.kml+xml"]), - ("kmz", &["application/vnd.google-earth.kmz"]), - ("kne", &["application/vnd.kinar"]), - ("knp", &["application/vnd.kinar"]), - ("kon", &["application/vnd.kde.kontour"]), - ("kpr", &["application/vnd.kde.kpresenter"]), - ("kpt", &["application/vnd.kde.kpresenter"]), - ("kpxx", &["application/vnd.ds-keypoint"]), - ("ksp", &["application/vnd.kde.kspread"]), - ("ktr", &["application/vnd.kahootz"]), - ("ktx", &["image/ktx"]), - ("ktz", &["application/vnd.kahootz"]), - ("kwd", &["application/vnd.kde.kword"]), - ("kwt", &["application/vnd.kde.kword"]), - ("lasxml", &["application/vnd.las.las+xml"]), - ("latex", &["application/x-latex"]), - ( - "lbd", - &["application/vnd.llamagraphics.life-balance.desktop"], - ), - ( - "lbe", - &["application/vnd.llamagraphics.life-balance.exchange+xml"], - ), - ("les", &["application/vnd.hhe.lesson-player"]), - ("less", &["text/less"]), - ("lha", &["application/x-lzh-compressed"]), - ("library-ms", &["application/windows-library+xml"]), - ("link66", &["application/vnd.route66.link66+xml"]), - ("list", &["text/plain"]), - ("list3820", &["application/vnd.ibm.modcap"]), - ("listafp", &["application/vnd.ibm.modcap"]), - ("lit", &["application/x-ms-reader"]), - ("litcoffee", &["text/coffeescript"]), - ("lnk", &["application/x-ms-shortcut"]), - ("loadtest", &["application/xml"]), - ("log", &["text/plain"]), - ("lostxml", &["application/lost+xml"]), - ("lpk", &["application/octet-stream"]), - ("lrf", &["application/octet-stream"]), - ("lrm", &["application/vnd.ms-lrm"]), - ("lsf", &["video/x-la-asf"]), - ("lst", &["text/plain"]), - ("lsx", &["video/x-la-asf"]), - ("ltf", &["application/vnd.frogans.ltf"]), - ("lua", &["text/x-lua"]), - ("luac", &["application/x-lua-bytecode"]), - ("lvp", &["audio/vnd.lucent.voice"]), - ("lwp", &["application/vnd.lotus-wordpro"]), - ("lzh", &["application/octet-stream"]), - ("m13", &["application/x-msmediaview"]), - ("m14", &["application/x-msmediaview"]), - ("m1v", &["video/mpeg"]), - ("m21", &["application/mp21"]), - ("m2a", &["audio/mpeg"]), - ("m2t", &["video/vnd.dlna.mpeg-tts"]), - ("m2ts", &["video/vnd.dlna.mpeg-tts"]), - ("m2v", &["video/mpeg"]), - ("m3a", &["audio/mpeg"]), - ("m3u", &["audio/x-mpegurl"]), - ("m3u8", &["audio/x-mpegurl"]), - ("m4a", &["audio/m4a"]), - ("m4b", &["audio/m4b"]), - ("m4p", &["audio/m4p"]), - ("m4r", &["audio/x-m4r"]), - ("m4u", &["video/vnd.mpegurl"]), - ("m4v", &["video/x-m4v"]), - ("ma", &["application/mathematica"]), - ("mac", &["image/x-macpaint"]), - ("mads", &["application/mads+xml"]), - ("mag", &["application/vnd.ecowin.chart"]), - ("mak", &["text/plain"]), - ("maker", &["application/vnd.framemaker"]), - ("man", &["application/x-troff-man"]), - ("manifest", &["application/x-ms-manifest"]), - ("map", &["text/plain"]), - ("mar", &["application/octet-stream"]), - ("markdown", &["text/markdown"]), - ("master", &["application/xml"]), - ("mathml", &["application/mathml+xml"]), - ("mb", &["application/mathematica"]), - ("mbk", &["application/vnd.mobius.mbk"]), - ("mbox", &["application/mbox"]), - ("mc1", &["application/vnd.medcalcdata"]), - ("mcd", &["application/vnd.mcd"]), - ("mcurl", &["text/vnd.curl.mcurl"]), - ("md", &["text/markdown", "text/x-markdown"]), - ("mda", &["application/msaccess"]), - ("mdb", &["application/x-msaccess"]), - ("mde", &["application/msaccess"]), - ("mdi", &["image/vnd.ms-modi"]), - ("mdp", &["application/octet-stream"]), - ("me", &["application/x-troff-me"]), - ("mesh", &["model/mesh"]), - ("meta4", &["application/metalink4+xml"]), - ("metalink", &["application/metalink+xml"]), - ("mets", &["application/mets+xml"]), - ("mfm", &["application/vnd.mfmp"]), - ("mfp", &["application/x-shockwave-flash"]), - ("mft", &["application/rpki-manifest"]), - ("mgp", &["application/vnd.osgeo.mapguide.package"]), - ("mgz", &["application/vnd.proteus.magazine"]), - ("mht", &["message/rfc822"]), - ("mhtml", &["message/rfc822"]), - ("mid", &["audio/mid"]), - ("midi", &["audio/mid"]), - ("mie", &["application/x-mie"]), - ("mif", &["application/vnd.mif"]), - ("mime", &["message/rfc822"]), - ("mix", &["application/octet-stream"]), - ("mj2", &["video/mj2"]), - ("mjp2", &["video/mj2"]), - ("mjs", &["application/javascript"]), - ("mk", &["text/plain"]), - ("mk3d", &["video/x-matroska"]), - ("mka", &["audio/x-matroska"]), - ("mkd", &["text/x-markdown"]), - ("mks", &["video/x-matroska"]), - ("mkv", &["video/x-matroska"]), - ("mlp", &["application/vnd.dolby.mlp"]), - ("mmd", &["application/vnd.chipnuts.karaoke-mmd"]), - ("mmf", &["application/x-smaf"]), - ("mml", &["text/mathml"]), - ("mmr", &["image/vnd.fujixerox.edmics-mmr"]), - ("mng", &["video/x-mng"]), - ("mno", &["text/xml"]), - ("mny", &["application/x-msmoney"]), - ("mobi", &["application/x-mobipocket-ebook"]), - ("mod", &["video/mpeg"]), - ("mods", &["application/mods+xml"]), - ("mov", &["video/quicktime"]), - ("movie", &["video/x-sgi-movie"]), - ("mp2", &["audio/mpeg", "video/mpeg"]), - ("mp21", &["application/mp21"]), - ("mp2a", &["audio/mpeg"]), - ("mp2v", &["video/mpeg"]), - ("mp3", &["audio/mpeg"]), - ("mp4", &["video/mp4"]), - ("mp4a", &["audio/mp4"]), - ("mp4s", &["application/mp4"]), - ("mp4v", &["video/mp4"]), - ("mpa", &["video/mpeg"]), - ("mpc", &["application/vnd.mophun.certificate"]), - ("mpd", &["application/dash+xml"]), - ("mpe", &["video/mpeg"]), - ("mpeg", &["video/mpeg"]), - ("mpf", &["application/vnd.ms-mediapackage"]), - ("mpg", &["video/mpeg"]), - ("mpg4", &["video/mp4"]), - ("mpga", &["audio/mpeg"]), - ("mpkg", &["application/vnd.apple.installer+xml"]), - ("mpm", &["application/vnd.blueice.multipass"]), - ("mpn", &["application/vnd.mophun.application"]), - ("mpp", &["application/vnd.ms-project"]), - ("mpt", &["application/vnd.ms-project"]), - ("mpv2", &["video/mpeg"]), - ("mpy", &["application/vnd.ibm.minipay"]), - ("mqv", &["video/quicktime"]), - ("mqy", &["application/vnd.mobius.mqy"]), - ("mrc", &["application/marc"]), - ("mrcx", &["application/marcxml+xml"]), - ("ms", &["application/x-troff-ms"]), - ("mscml", &["application/mediaservercontrol+xml"]), - ("mseed", &["application/vnd.fdsn.mseed"]), - ("mseq", &["application/vnd.mseq"]), - ("msf", &["application/vnd.epson.msf"]), - ("msg", &["application/vnd.ms-outlook"]), - ("msh", &["model/mesh"]), - ("msi", &["application/octet-stream"]), - ("msl", &["application/vnd.mobius.msl"]), - ("msm", &["application/octet-stream"]), - ("mso", &["application/octet-stream"]), - ("msp", &["application/octet-stream"]), - ("msty", &["application/vnd.muvee.style"]), - ("mts", &["video/vnd.dlna.mpeg-tts"]), - ("mtx", &["application/xml"]), - ("mus", &["application/vnd.musician"]), - ("musicxml", &["application/vnd.recordare.musicxml+xml"]), - ("mvb", &["application/x-msmediaview"]), - ("mvc", &["application/x-miva-compiled"]), - ("mwf", &["application/vnd.mfer"]), - ("mxf", &["application/mxf"]), - ("mxl", &["application/vnd.recordare.musicxml"]), - ("mxml", &["application/xv+xml"]), - ("mxp", &["application/x-mmxp"]), - ("mxs", &["application/vnd.triscape.mxs"]), - ("mxu", &["video/vnd.mpegurl"]), - ("n-gage", &["application/vnd.nokia.n-gage.symbian.install"]), - ("n3", &["text/n3"]), - ("nb", &["application/mathematica"]), - ("nbp", &["application/vnd.wolfram.player"]), - ("nc", &["application/x-netcdf"]), - ("ncx", &["application/x-dtbncx+xml"]), - ("nfo", &["text/x-nfo"]), - ("ngdat", &["application/vnd.nokia.n-gage.data"]), - ("nitf", &["application/vnd.nitf"]), - ("nlu", &["application/vnd.neurolanguage.nlu"]), - ("nml", &["application/vnd.enliven"]), - ("nnd", &["application/vnd.noblenet-directory"]), - ("nns", &["application/vnd.noblenet-sealer"]), - ("nnw", &["application/vnd.noblenet-web"]), - ("npx", &["image/vnd.net-fpx"]), - ("nq", &["application/n-quads"]), - ("nsc", &["video/x-ms-asf"]), - ("nsf", &["application/vnd.lotus-notes"]), - ("nt", &["application/n-triples"]), - ("ntf", &["application/vnd.nitf"]), - ("nws", &["message/rfc822"]), - ("nzb", &["application/x-nzb"]), - ("oa2", &["application/vnd.fujitsu.oasys2"]), - ("oa3", &["application/vnd.fujitsu.oasys3"]), - ("oas", &["application/vnd.fujitsu.oasys"]), - ("obd", &["application/x-msbinder"]), - ("obj", &["application/x-tgif"]), - ("ocx", &["application/octet-stream"]), - ("oda", &["application/oda"]), - ("odb", &["application/vnd.oasis.opendocument.database"]), - ("odc", &["application/vnd.oasis.opendocument.chart"]), - ("odf", &["application/vnd.oasis.opendocument.formula"]), - ( - "odft", - &["application/vnd.oasis.opendocument.formula-template"], - ), - ("odg", &["application/vnd.oasis.opendocument.graphics"]), - ("odh", &["text/plain"]), - ("odi", &["application/vnd.oasis.opendocument.image"]), - ("odl", &["text/plain"]), - ("odm", &["application/vnd.oasis.opendocument.text-master"]), - ("odp", &["application/vnd.oasis.opendocument.presentation"]), - ("ods", &["application/vnd.oasis.opendocument.spreadsheet"]), - ("odt", &["application/vnd.oasis.opendocument.text"]), - ("oga", &["audio/ogg"]), - ("ogg", &["audio/ogg"]), - ("ogv", &["video/ogg"]), - ("ogx", &["application/ogg"]), - ("omdoc", &["application/omdoc+xml"]), - ("one", &["application/onenote"]), - ("onea", &["application/onenote"]), - ("onepkg", &["application/onenote"]), - ("onetmp", &["application/onenote"]), - ("onetoc", &["application/onenote"]), - ("onetoc2", &["application/onenote"]), - ("opf", &["application/oebps-package+xml"]), - ("opml", &["text/x-opml"]), - ("oprc", &["application/vnd.palm"]), - ("opus", &["audio/ogg"]), - ("orderedtest", &["application/xml"]), - ("org", &["application/vnd.lotus-organizer"]), - ("osdx", &["application/opensearchdescription+xml"]), - ("osf", &["application/vnd.yamaha.openscoreformat"]), - ( - "osfpvg", - &["application/vnd.yamaha.openscoreformat.osfpvg+xml"], - ), - ( - "otc", - &["application/vnd.oasis.opendocument.chart-template"], - ), - ("otf", &["application/font-sfnt"]), - ( - "otg", - &["application/vnd.oasis.opendocument.graphics-template"], - ), - ("oth", &["application/vnd.oasis.opendocument.text-web"]), - ( - "oti", - &["application/vnd.oasis.opendocument.image-template"], - ), - ( - "otp", - &["application/vnd.oasis.opendocument.presentation-template"], - ), - ( - "ots", - &["application/vnd.oasis.opendocument.spreadsheet-template"], - ), - ("ott", &["application/vnd.oasis.opendocument.text-template"]), - ("ova", &["application/x-virtualbox-ova"]), - ("ovf", &["application/x-virtualbox-ovf"]), - ("oxps", &["application/oxps"]), - ("oxt", &["application/vnd.openofficeorg.extension"]), - ("p", &["text/x-pascal"]), - ("p10", &["application/pkcs10"]), - ("p12", &["application/x-pkcs12"]), - ("p7b", &["application/x-pkcs7-certificates"]), - ("p7c", &["application/pkcs7-mime"]), - ("p7m", &["application/pkcs7-mime"]), - ("p7r", &["application/x-pkcs7-certreqresp"]), - ("p7s", &["application/pkcs7-signature"]), - ("p8", &["application/pkcs8"]), - ("pac", &["application/x-ns-proxy-autoconfig"]), - ("pas", &["text/x-pascal"]), - ("paw", &["application/vnd.pawaafile"]), - ("pbd", &["application/vnd.powerbuilder6"]), - ("pbm", &["image/x-portable-bitmap"]), - ("pcap", &["application/vnd.tcpdump.pcap"]), - ("pcast", &["application/x-podcast"]), - ("pcf", &["application/x-font-pcf"]), - ("pcl", &["application/vnd.hp-pcl"]), - ("pclxl", &["application/vnd.hp-pclxl"]), - ("pct", &["image/pict"]), - ("pcurl", &["application/vnd.curl.pcurl"]), - ("pcx", &["application/octet-stream"]), - ("pcz", &["application/octet-stream"]), - ("pdb", &["application/vnd.palm"]), - ("pde", &["text/x-processing"]), - ("pdf", &["application/pdf"]), - ("pem", &["application/x-x509-ca-cert"]), - ("pfa", &["application/x-font-type1"]), - ("pfb", &["application/octet-stream"]), - ("pfm", &["application/octet-stream"]), - ("pfr", &["application/font-tdpfr"]), - ("pfx", &["application/x-pkcs12"]), - ("pgm", &["image/x-portable-graymap"]), - ("pgn", &["application/x-chess-pgn"]), - ("pgp", &["application/pgp-encrypted"]), - ("php", &["application/x-httpd-php"]), - ("pic", &["image/pict"]), - ("pict", &["image/pict"]), - ("pkg", &["application/octet-stream"]), - ("pkgdef", &["text/plain"]), - ("pkgundef", &["text/plain"]), - ("pki", &["application/pkixcmp"]), - ("pkipath", &["application/pkix-pkipath"]), - ("pko", &["application/vnd.ms-pki.pko"]), - ("pkpass", &["application/vnd.apple.pkpass"]), - ("pl", &["application/x-perl"]), - ("plb", &["application/vnd.3gpp.pic-bw-large"]), - ("plc", &["application/vnd.mobius.plc"]), - ("plf", &["application/vnd.pocketlearn"]), - ("pls", &["audio/scpls"]), - ("pm", &["application/x-perl"]), - ("pma", &["application/x-perfmon"]), - ("pmc", &["application/x-perfmon"]), - ("pml", &["application/x-perfmon"]), - ("pmr", &["application/x-perfmon"]), - ("pmw", &["application/x-perfmon"]), - ("png", &["image/png"]), - ("pnm", &["image/x-portable-anymap"]), - ("pnt", &["image/x-macpaint"]), - ("pntg", &["image/x-macpaint"]), - ("pnz", &["image/png"]), - ("portpkg", &["application/vnd.macports.portpkg"]), - ("pot", &["application/vnd.ms-powerpoint"]), - ( - "potm", - &["application/vnd.ms-powerpoint.template.macroEnabled.12"], - ), - ( - "potx", - &["application/vnd.openxmlformats-officedocument.presentationml.template"], - ), - ("ppa", &["application/vnd.ms-powerpoint"]), - ( - "ppam", - &["application/vnd.ms-powerpoint.addin.macroEnabled.12"], - ), - ("ppd", &["application/vnd.cups-ppd"]), - ("ppm", &["image/x-portable-pixmap"]), - ("pps", &["application/vnd.ms-powerpoint"]), - ( - "ppsm", - &["application/vnd.ms-powerpoint.slideshow.macroEnabled.12"], - ), - ( - "ppsx", - &["application/vnd.openxmlformats-officedocument.presentationml.slideshow"], - ), - ("ppt", &["application/vnd.ms-powerpoint"]), - ( - "pptm", - &["application/vnd.ms-powerpoint.presentation.macroEnabled.12"], - ), - ( - "pptx", - &["application/vnd.openxmlformats-officedocument.presentationml.presentation"], - ), - ("pqa", &["application/vnd.palm"]), - ("prc", &["application/x-mobipocket-ebook"]), - ("pre", &["application/vnd.lotus-freelance"]), - ("prf", &["application/pics-rules"]), - ("prm", &["application/octet-stream"]), - ("prx", &["application/octet-stream"]), - ("ps", &["application/postscript"]), - ("psb", &["application/vnd.3gpp.pic-bw-small"]), - ("psc1", &["application/PowerShell"]), - ("psd", &["application/octet-stream"]), - ("psess", &["application/xml"]), - ("psf", &["application/x-font-linux-psf"]), - ("pskcxml", &["application/pskc+xml"]), - ("psm", &["application/octet-stream"]), - ("psp", &["application/octet-stream"]), - ("pst", &["application/vnd.ms-outlook"]), - ("ptid", &["application/vnd.pvi.ptid1"]), - ("pub", &["application/x-mspublisher"]), - ("pvb", &["application/vnd.3gpp.pic-bw-var"]), - ("pwn", &["application/vnd.3m.post-it-notes"]), - ("pwz", &["application/vnd.ms-powerpoint"]), - ("py", &["text/plain"]), - ("pya", &["audio/vnd.ms-playready.media.pya"]), - ("pyv", &["video/vnd.ms-playready.media.pyv"]), - ("qam", &["application/vnd.epson.quickanime"]), - ("qbo", &["application/vnd.intu.qbo"]), - ("qfx", &["application/vnd.intu.qfx"]), - ("qht", &["text/x-html-insertion"]), - ("qhtm", &["text/x-html-insertion"]), - ("qps", &["application/vnd.publishare-delta-tree"]), - ("qt", &["video/quicktime"]), - ("qti", &["image/x-quicktime"]), - ("qtif", &["image/x-quicktime"]), - ("qtl", &["application/x-quicktimeplayer"]), - ("qwd", &["application/vnd.quark.quarkxpress"]), - ("qwt", &["application/vnd.quark.quarkxpress"]), - ("qxb", &["application/vnd.quark.quarkxpress"]), - ("qxd", &["application/octet-stream"]), - ("qxl", &["application/vnd.quark.quarkxpress"]), - ("qxt", &["application/vnd.quark.quarkxpress"]), - ("ra", &["audio/x-pn-realaudio"]), - ("ram", &["audio/x-pn-realaudio"]), - ("raml", &["application/raml+yaml"]), - ("rar", &["application/x-rar-compressed"]), - ("ras", &["image/x-cmu-raster"]), - ("rat", &["application/rat-file"]), - ("rc", &["text/plain"]), - ("rc2", &["text/plain"]), - ("rcprofile", &["application/vnd.ipunplugged.rcprofile"]), - ("rct", &["text/plain"]), - ("rdf", &["application/rdf+xml"]), - ("rdlc", &["application/xml"]), - ("rdz", &["application/vnd.data-vision.rdz"]), - ("reg", &["text/plain"]), - ("rep", &["application/vnd.businessobjects"]), - ("res", &["application/x-dtbresource+xml"]), - ("resx", &["application/xml"]), - ("rf", &["image/vnd.rn-realflash"]), - ("rgb", &["image/x-rgb"]), - ("rgs", &["text/plain"]), - ("rif", &["application/reginfo+xml"]), - ("rip", &["audio/vnd.rip"]), - ("ris", &["application/x-research-info-systems"]), - ("rl", &["application/resource-lists+xml"]), - ("rlc", &["image/vnd.fujixerox.edmics-rlc"]), - ("rld", &["application/resource-lists-diff+xml"]), - ("rm", &["application/vnd.rn-realmedia"]), - ("rmi", &["audio/mid"]), - ("rmp", &["application/vnd.rn-rn_music_package"]), - ("rms", &["application/vnd.jcp.javame.midlet-rms"]), - ("rmvb", &["application/vnd.rn-realmedia-vbr"]), - ("rnc", &["application/relax-ng-compact-syntax"]), - ("rng", &["application/xml"]), - ("roa", &["application/rpki-roa"]), - ("roff", &["application/x-troff"]), - ("rp9", &["application/vnd.cloanto.rp9"]), - ("rpm", &["audio/x-pn-realaudio-plugin"]), - ("rpss", &["application/vnd.nokia.radio-presets"]), - ("rpst", &["application/vnd.nokia.radio-preset"]), - ("rq", &["application/sparql-query"]), - ("rqy", &["text/x-ms-rqy"]), - ("rs", &["text/x-rust"]), - ("rsd", &["application/rsd+xml"]), - ("rss", &["application/rss+xml"]), - ("rtf", &["application/rtf"]), - ("rtx", &["text/richtext"]), - ("ruleset", &["application/xml"]), - ("run", &["application/x-makeself"]), - ("rvt", &["application/octet-stream"]), - ("s", &["text/plain"]), - ("s3m", &["audio/s3m"]), - ("saf", &["application/vnd.yamaha.smaf-audio"]), - ("safariextz", &["application/x-safari-safariextz"]), - ("sass", &["text/x-sass"]), - ("sbml", &["application/sbml+xml"]), - ("sc", &["application/vnd.ibm.secure-container"]), - ("scd", &["application/x-msschedule"]), - ("scm", &["application/vnd.lotus-screencam"]), - ("scq", &["application/scvp-cv-request"]), - ("scr", &["text/plain"]), - ("scs", &["application/scvp-cv-response"]), - ("scss", &["text/x-scss"]), - ("sct", &["text/scriptlet"]), - ("scurl", &["text/vnd.curl.scurl"]), - ("sd2", &["audio/x-sd2"]), - ("sda", &["application/vnd.stardivision.draw"]), - ("sdc", &["application/vnd.stardivision.calc"]), - ("sdd", &["application/vnd.stardivision.impress"]), - ("sdkd", &["application/vnd.solent.sdkm+xml"]), - ("sdkm", &["application/vnd.solent.sdkm+xml"]), - ("sdp", &["application/sdp"]), - ("sdw", &["application/vnd.stardivision.writer"]), - ("sea", &["application/octet-stream"]), - ( - "searchconnector-ms", - &["application/windows-search-connector+xml"], - ), - ("see", &["application/vnd.seemail"]), - ("seed", &["application/vnd.fdsn.seed"]), - ("sema", &["application/vnd.sema"]), - ("semd", &["application/vnd.semd"]), - ("semf", &["application/vnd.semf"]), - ("ser", &["application/java-serialized-object"]), - ("setpay", &["application/set-payment-initiation"]), - ("setreg", &["application/set-registration-initiation"]), - ("settings", &["application/xml"]), - ("sfd-hdstx", &["application/vnd.hydrostatix.sof-data"]), - ("sfs", &["application/vnd.spotfire.sfs"]), - ("sfv", &["text/x-sfv"]), - ("sgi", &["image/sgi"]), - ("sgimb", &["application/x-sgimb"]), - ("sgl", &["application/vnd.stardivision.writer-global"]), - ("sgm", &["text/sgml"]), - ("sgml", &["text/sgml"]), - ("sh", &["application/x-sh"]), - ("shar", &["application/x-shar"]), - ("shex", &["text/shex"]), - ("shf", &["application/shf+xml"]), - ("shtml", &["text/html"]), - ("sid", &["image/x-mrsid-image"]), - ("sig", &["application/pgp-signature"]), - ("sil", &["audio/silk"]), - ("silo", &["model/mesh"]), - ("sis", &["application/vnd.symbian.install"]), - ("sisx", &["application/vnd.symbian.install"]), - ("sit", &["application/x-stuffit"]), - ("sitemap", &["application/xml"]), - ("sitx", &["application/x-stuffitx"]), - ("skd", &["application/vnd.koan"]), - ("skin", &["application/xml"]), - ("skm", &["application/vnd.koan"]), - ("skp", &["application/x-koan"]), - ("skt", &["application/vnd.koan"]), - ( - "sldm", - &["application/vnd.ms-powerpoint.slide.macroEnabled.12"], - ), - ( - "sldx", - &["application/vnd.openxmlformats-officedocument.presentationml.slide"], - ), - ("slim", &["text/slim"]), - ("slk", &["application/vnd.ms-excel"]), - ("slm", &["text/slim"]), - ("sln", &["text/plain"]), - ("slt", &["application/vnd.epson.salt"]), - ("slupkg-ms", &["application/x-ms-license"]), - ("sm", &["application/vnd.stepmania.stepchart"]), - ("smd", &["audio/x-smd"]), - ("smf", &["application/vnd.stardivision.math"]), - ("smi", &["application/octet-stream"]), - ("smil", &["application/smil+xml"]), - ("smv", &["video/x-smv"]), - ("smx", &["audio/x-smd"]), - ("smz", &["audio/x-smd"]), - ("smzip", &["application/vnd.stepmania.package"]), - ("snd", &["audio/basic"]), - ("snf", &["application/x-font-snf"]), - ("snippet", &["application/xml"]), - ("snp", &["application/octet-stream"]), - ("so", &["application/octet-stream"]), - ("sol", &["text/plain"]), - ("sor", &["text/plain"]), - ("spc", &["application/x-pkcs7-certificates"]), - ("spf", &["application/vnd.yamaha.smaf-phrase"]), - ("spl", &["application/futuresplash"]), - ("spot", &["text/vnd.in3d.spot"]), - ("spp", &["application/scvp-vp-response"]), - ("spq", &["application/scvp-vp-request"]), - ("spx", &["audio/ogg"]), - ("sql", &["application/x-sql"]), - ("src", &["application/x-wais-source"]), - ("srf", &["text/plain"]), - ("srt", &["application/x-subrip"]), - ("sru", &["application/sru+xml"]), - ("srx", &["application/sparql-results+xml"]), - ("ssdl", &["application/ssdl+xml"]), - ("sse", &["application/vnd.kodak-descriptor"]), - ("ssf", &["application/vnd.epson.ssf"]), - ("ssisdeploymentmanifest", &["text/xml"]), - ("ssm", &["application/streamingmedia"]), - ("ssml", &["application/ssml+xml"]), - ("sst", &["application/vnd.ms-pki.certstore"]), - ("st", &["application/vnd.sailingtracker.track"]), - ("stc", &["application/vnd.sun.xml.calc.template"]), - ("std", &["application/vnd.sun.xml.draw.template"]), - ("step", &["application/step"]), - ("stf", &["application/vnd.wt.stf"]), - ("sti", &["application/vnd.sun.xml.impress.template"]), - ("stk", &["application/hyperstudio"]), - ("stl", &["application/vnd.ms-pki.stl"]), - ("stp", &["application/step"]), - ("str", &["application/vnd.pg.format"]), - ("stw", &["application/vnd.sun.xml.writer.template"]), - ("styl", &["text/stylus"]), - ("stylus", &["text/stylus"]), - ("sub", &["text/vnd.dvb.subtitle"]), - ("sus", &["application/vnd.sus-calendar"]), - ("susp", &["application/vnd.sus-calendar"]), - ("sv4cpio", &["application/x-sv4cpio"]), - ("sv4crc", &["application/x-sv4crc"]), - ("svc", &["application/xml"]), - ("svd", &["application/vnd.svd"]), - ("svg", &["image/svg+xml"]), - ("svgz", &["image/svg+xml"]), - ("swa", &["application/x-director"]), - ("swf", &["application/x-shockwave-flash"]), - ("swi", &["application/vnd.aristanetworks.swi"]), - ("sxc", &["application/vnd.sun.xml.calc"]), - ("sxd", &["application/vnd.sun.xml.draw"]), - ("sxg", &["application/vnd.sun.xml.writer.global"]), - ("sxi", &["application/vnd.sun.xml.impress"]), - ("sxm", &["application/vnd.sun.xml.math"]), - ("sxw", &["application/vnd.sun.xml.writer"]), - ("t", &["application/x-troff"]), - ("t3", &["application/x-t3vm-image"]), - ("taglet", &["application/vnd.mynfc"]), - ("tao", &["application/vnd.tao.intent-module-archive"]), - ("tar", &["application/x-tar"]), - ("tcap", &["application/vnd.3gpp2.tcap"]), - ("tcl", &["application/x-tcl"]), - ("teacher", &["application/vnd.smart.teacher"]), - ("tei", &["application/tei+xml"]), - ("teicorpus", &["application/tei+xml"]), - ("testrunconfig", &["application/xml"]), - ("testsettings", &["application/xml"]), - ("tex", &["application/x-tex"]), - ("texi", &["application/x-texinfo"]), - ("texinfo", &["application/x-texinfo"]), - ("text", &["text/plain"]), - ("tfi", &["application/thraud+xml"]), - ("tfm", &["application/x-tex-tfm"]), - ("tga", &["image/x-tga"]), - ("tgz", &["application/x-compressed"]), - ("thmx", &["application/vnd.ms-officetheme"]), - ("thn", &["application/octet-stream"]), - ("tif", &["image/tiff"]), - ("tiff", &["image/tiff"]), - ("tk", &["application/x-tcl"]), - ("tlh", &["text/plain"]), - ("tli", &["text/plain"]), - ("tmo", &["application/vnd.tmobile-livetv"]), - ("toc", &["application/octet-stream"]), - ("toml", &["text/x-toml"]), - ("torrent", &["application/x-bittorrent"]), - ("tpl", &["application/vnd.groove-tool-template"]), - ("tpt", &["application/vnd.trid.tpt"]), - ("tr", &["application/x-troff"]), - ("tra", &["application/vnd.trueapp"]), - ("trig", &["application/trig"]), - ("trm", &["application/x-msterminal"]), - ("trx", &["application/xml"]), - ("ts", &["video/vnd.dlna.mpeg-tts"]), - ("tsd", &["application/timestamped-data"]), - ("tsv", &["text/tab-separated-values"]), - ("ttc", &["font/collection"]), - ("ttf", &["font/ttf", "application/x-font-ttf", "application/font-sfnt"]), - ("ttl", &["text/turtle"]), - ("tts", &["video/vnd.dlna.mpeg-tts"]), - ("twd", &["application/vnd.simtech-mindmapper"]), - ("twds", &["application/vnd.simtech-mindmapper"]), - ("txd", &["application/vnd.genomatix.tuxedo"]), - ("txf", &["application/vnd.mobius.txf"]), - ("txt", &["text/plain"]), - ("u32", &["application/octet-stream"]), - ("u8dsn", &["message/global-delivery-status"]), - ("u8hdr", &["message/global-headers"]), - ("u8mdn", &["message/global-disposition-notification"]), - ("u8msg", &["message/global"]), - ("udeb", &["application/x-debian-package"]), - ("ufd", &["application/vnd.ufdl"]), - ("ufdl", &["application/vnd.ufdl"]), - ("uls", &["text/iuls"]), - ("ulx", &["application/x-glulx"]), - ("umj", &["application/vnd.umajin"]), - ("unityweb", &["application/vnd.unity"]), - ("uoml", &["application/vnd.uoml+xml"]), - ("uri", &["text/uri-list"]), - ("uris", &["text/uri-list"]), - ("urls", &["text/uri-list"]), - ("user", &["text/plain"]), - ("ustar", &["application/x-ustar"]), - ("utz", &["application/vnd.uiq.theme"]), - ("uu", &["text/x-uuencode"]), - ("uva", &["audio/vnd.dece.audio"]), - ("uvd", &["application/vnd.dece.data"]), - ("uvf", &["application/vnd.dece.data"]), - ("uvg", &["image/vnd.dece.graphic"]), - ("uvh", &["video/vnd.dece.hd"]), - ("uvi", &["image/vnd.dece.graphic"]), - ("uvm", &["video/vnd.dece.mobile"]), - ("uvp", &["video/vnd.dece.pd"]), - ("uvs", &["video/vnd.dece.sd"]), - ("uvt", &["application/vnd.dece.ttml+xml"]), - ("uvu", &["video/vnd.uvvu.mp4"]), - ("uvv", &["video/vnd.dece.video"]), - ("uvva", &["audio/vnd.dece.audio"]), - ("uvvd", &["application/vnd.dece.data"]), - ("uvvf", &["application/vnd.dece.data"]), - ("uvvg", &["image/vnd.dece.graphic"]), - ("uvvh", &["video/vnd.dece.hd"]), - ("uvvi", &["image/vnd.dece.graphic"]), - ("uvvm", &["video/vnd.dece.mobile"]), - ("uvvp", &["video/vnd.dece.pd"]), - ("uvvs", &["video/vnd.dece.sd"]), - ("uvvt", &["application/vnd.dece.ttml+xml"]), - ("uvvu", &["video/vnd.uvvu.mp4"]), - ("uvvv", &["video/vnd.dece.video"]), - ("uvvx", &["application/vnd.dece.unspecified"]), - ("uvvz", &["application/vnd.dece.zip"]), - ("uvx", &["application/vnd.dece.unspecified"]), - ("uvz", &["application/vnd.dece.zip"]), - ("vb", &["text/plain"]), - ("vbdproj", &["text/plain"]), - ("vbk", &["video/mpeg"]), - ("vbox", &["application/x-virtualbox-vbox"]), - ("vbox-extpack", &["application/x-virtualbox-vbox-extpack"]), - ("vbproj", &["text/plain"]), - ("vbs", &["text/vbscript"]), - ("vcard", &["text/vcard"]), - ("vcd", &["application/x-cdlink"]), - ("vcf", &["text/x-vcard"]), - ("vcg", &["application/vnd.groove-vcard"]), - ("vcproj", &["application/xml"]), - ("vcs", &["text/plain"]), - ("vcx", &["application/vnd.vcx"]), - ("vcxproj", &["application/xml"]), - ("vddproj", &["text/plain"]), - ("vdi", &["application/x-virtualbox-vdi"]), - ("vdp", &["text/plain"]), - ("vdproj", &["text/plain"]), - ("vdx", &["application/vnd.ms-visio.viewer"]), - ("vhd", &["application/x-virtualbox-vhd"]), - ("vis", &["application/vnd.visionary"]), - ("viv", &["video/vnd.vivo"]), - ("vmdk", &["application/x-virtualbox-vmdk"]), - ("vml", &["text/xml"]), - ("vob", &["video/x-ms-vob"]), - ("vor", &["application/vnd.stardivision.writer"]), - ("vox", &["application/x-authorware-bin"]), - ("vrml", &["model/vrml"]), - ("vscontent", &["application/xml"]), - ("vsct", &["text/xml"]), - ("vsd", &["application/vnd.visio"]), - ("vsf", &["application/vnd.vsf"]), - ("vsi", &["application/ms-vsi"]), - ("vsix", &["application/vsix"]), - ("vsixlangpack", &["text/xml"]), - ("vsixmanifest", &["text/xml"]), - ("vsmdi", &["application/xml"]), - ("vspscc", &["text/plain"]), - ("vss", &["application/vnd.visio"]), - ("vsscc", &["text/plain"]), - ("vssettings", &["text/xml"]), - ("vssscc", &["text/plain"]), - ("vst", &["application/vnd.visio"]), - ("vstemplate", &["text/xml"]), - ("vsto", &["application/x-ms-vsto"]), - ("vsw", &["application/vnd.visio"]), - ("vsx", &["application/vnd.visio"]), - ("vtt", &["text/vtt"]), - ("vtu", &["model/vnd.vtu"]), - ("vtx", &["application/vnd.visio"]), - ("vxml", &["application/voicexml+xml"]), - ("w3d", &["application/x-director"]), - ("wad", &["application/x-doom"]), - ("wadl", &["application/vnd.sun.wadl+xml"]), - ("war", &["application/java-archive"]), - ("wasm", &["application/wasm"]), - ("wav", &["audio/wav"]), - ("wave", &["audio/wav"]), - ("wax", &["audio/x-ms-wax"]), - ("wbk", &["application/msword"]), - ("wbmp", &["image/vnd.wap.wbmp"]), - ("wbs", &["application/vnd.criticaltools.wbs+xml"]), - ("wbxml", &["application/vnd.wap.wbxml"]), - ("wcm", &["application/vnd.ms-works"]), - ("wdb", &["application/vnd.ms-works"]), - ("wdp", &["image/vnd.ms-photo"]), - ("weba", &["audio/webm"]), - ("webapp", &["application/x-web-app-manifest+json"]), - ("webarchive", &["application/x-safari-webarchive"]), - ("webm", &["video/webm"]), - ("webmanifest", &["application/manifest+json"]), - ("webp", &["image/webp"]), - ("webtest", &["application/xml"]), - ("wg", &["application/vnd.pmi.widget"]), - ("wgt", &["application/widget"]), - ("wiq", &["application/xml"]), - ("wiz", &["application/msword"]), - ("wks", &["application/vnd.ms-works"]), - ("wlmp", &["application/wlmoviemaker"]), - ("wlpginstall", &["application/x-wlpg-detect"]), - ("wlpginstall3", &["application/x-wlpg3-detect"]), - ("wm", &["video/x-ms-wm"]), - ("wma", &["audio/x-ms-wma"]), - ("wmd", &["application/x-ms-wmd"]), - ("wmf", &["application/x-msmetafile"]), - ("wml", &["text/vnd.wap.wml"]), - ("wmlc", &["application/vnd.wap.wmlc"]), - ("wmls", &["text/vnd.wap.wmlscript"]), - ("wmlsc", &["application/vnd.wap.wmlscriptc"]), - ("wmp", &["video/x-ms-wmp"]), - ("wmv", &["video/x-ms-wmv"]), - ("wmx", &["video/x-ms-wmx"]), - ("wmz", &["application/x-ms-wmz"]), - ("woff", &["application/font-woff"]), - ("woff2", &["font/woff2"]), - ("wpd", &["application/vnd.wordperfect"]), - ("wpl", &["application/vnd.ms-wpl"]), - ("wps", &["application/vnd.ms-works"]), - ("wqd", &["application/vnd.wqd"]), - ("wri", &["application/x-mswrite"]), - ("wrl", &["x-world/x-vrml"]), - ("wrz", &["x-world/x-vrml"]), - ("wsc", &["text/scriptlet"]), - ("wsdl", &["text/xml"]), - ("wspolicy", &["application/wspolicy+xml"]), - ("wtb", &["application/vnd.webturbo"]), - ("wvx", &["video/x-ms-wvx"]), - ("x", &["application/directx"]), - ("x32", &["application/x-authorware-bin"]), - ("x3d", &["model/x3d+xml"]), - ("x3db", &["model/x3d+binary"]), - ("x3dbz", &["model/x3d+binary"]), - ("x3dv", &["model/x3d+vrml"]), - ("x3dvz", &["model/x3d+vrml"]), - ("x3dz", &["model/x3d+xml"]), - ("xaf", &["x-world/x-vrml"]), - ("xaml", &["application/xaml+xml"]), - ("xap", &["application/x-silverlight-app"]), - ("xar", &["application/vnd.xara"]), - ("xbap", &["application/x-ms-xbap"]), - ("xbd", &["application/vnd.fujixerox.docuworks.binder"]), - ("xbm", &["image/x-xbitmap"]), - ("xdf", &["application/xcap-diff+xml"]), - ("xdm", &["application/vnd.syncml.dm+xml"]), - ("xdp", &["application/vnd.adobe.xdp+xml"]), - ("xdr", &["text/plain"]), - ("xdssc", &["application/dssc+xml"]), - ("xdw", &["application/vnd.fujixerox.docuworks"]), - ("xenc", &["application/xenc+xml"]), - ("xer", &["application/patch-ops-error+xml"]), - ("xfdf", &["application/vnd.adobe.xfdf"]), - ("xfdl", &["application/vnd.xfdl"]), - ("xht", &["application/xhtml+xml"]), - ("xhtml", &["application/xhtml+xml"]), - ("xhvml", &["application/xv+xml"]), - ("xif", &["image/vnd.xiff"]), - ("xla", &["application/vnd.ms-excel"]), - ("xlam", &["application/vnd.ms-excel.addin.macroEnabled.12"]), - ("xlc", &["application/vnd.ms-excel"]), - ("xld", &["application/vnd.ms-excel"]), - ("xlf", &["application/x-xliff+xml"]), - ("xlk", &["application/vnd.ms-excel"]), - ("xll", &["application/vnd.ms-excel"]), - ("xlm", &["application/vnd.ms-excel"]), - ("xls", &["application/vnd.ms-excel"]), - ( - "xlsb", - &["application/vnd.ms-excel.sheet.binary.macroEnabled.12"], - ), - ("xlsm", &["application/vnd.ms-excel.sheet.macroEnabled.12"]), - ( - "xlsx", - &["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"], - ), - ("xlt", &["application/vnd.ms-excel"]), - ( - "xltm", - &["application/vnd.ms-excel.template.macroEnabled.12"], - ), - ( - "xltx", - &["application/vnd.openxmlformats-officedocument.spreadsheetml.template"], - ), - ("xlw", &["application/vnd.ms-excel"]), - ("xm", &["audio/xm"]), - ("xml", &["text/xml"]), - ("xmp", &["application/octet-stream"]), - ("xmta", &["application/xml"]), - ("xo", &["application/vnd.olpc-sugar"]), - ("xof", &["x-world/x-vrml"]), - ("xoml", &["text/plain"]), - ("xop", &["application/xop+xml"]), - ("xpi", &["application/x-xpinstall"]), - ("xpl", &["application/xproc+xml"]), - ("xpm", &["image/x-xpixmap"]), - ("xpr", &["application/vnd.is-xpr"]), - ("xps", &["application/vnd.ms-xpsdocument"]), - ("xpw", &["application/vnd.intercon.formnet"]), - ("xpx", &["application/vnd.intercon.formnet"]), - ("xrm-ms", &["text/xml"]), - ("xsc", &["application/xml"]), - ("xsd", &["text/xml"]), - ("xsf", &["text/xml"]), - ("xsl", &["text/xml"]), - ("xslt", &["text/xml"]), - ("xsm", &["application/vnd.syncml+xml"]), - ("xsn", &["application/octet-stream"]), - ("xspf", &["application/xspf+xml"]), - ("xss", &["application/xml"]), - ("xtp", &["application/octet-stream"]), - ("xul", &["application/vnd.mozilla.xul+xml"]), - ("xvm", &["application/xv+xml"]), - ("xvml", &["application/xv+xml"]), - ("xwd", &["image/x-xwindowdump"]), - ("xyz", &["chemical/x-xyz"]), - ("xz", &["application/x-xz"]), - ("yaml", &["text/x-yaml"]), - ("yang", &["application/yang"]), - ("yin", &["application/yin+xml"]), - ("yml", &["text/x-yaml"]), - ("ymp", &["text/x-suse-ymp"]), - ("z", &["application/x-compress"]), - ("z1", &["application/x-zmachine"]), - ("z2", &["application/x-zmachine"]), - ("z3", &["application/x-zmachine"]), - ("z4", &["application/x-zmachine"]), - ("z5", &["application/x-zmachine"]), - ("z6", &["application/x-zmachine"]), - ("z7", &["application/x-zmachine"]), - ("z8", &["application/x-zmachine"]), - ("zaz", &["application/vnd.zzazz.deck+xml"]), - ("zip", &["application/zip"]), - ("zir", &["application/vnd.zul"]), - ("zirz", &["application/vnd.zul"]), - ("zmm", &["application/vnd.handheld-entertainment+xml"]), -]; +/// A mapping of known file extensions and their MIME types. +/// +/// Required to be sorted lexicographically by extension for ease of maintenance. +/// +/// Multiple MIME types per extension are supported; the order is arbitrary but the first should be +/// the most prevalent by most recent RFC declaration or explicit succession of other media types. +/// +/// NOTE: when adding or modifying entries, please include a citation in the commit message. +/// If a media type for an extension changed by official IETF RFC, please keep the old entry but add +/// the new one before it in the slice literal, e.g.: +/// +/// ```ignore +/// - ("md", &["text/x-markdown"]), +/// + ("md", &["text/markdown", "text/x-markdown"]), +/// ``` +/// +/// Sourced from: +/// https://github.com/samuelneff/MimeTypeMap/blob/master/src/MimeTypes/MimeTypeMap.cs +/// https://github.com/jshttp/mime-db extracted with https://gist.github.com/soyuka/b7e29d359b2c14c21bdead923c01cc81 +pub static MIME_TYPES: &[(&str, &[&str])] = &[ + ("123", &["application/vnd.lotus-1-2-3"]), + ("323", &["text/h323"]), + ("3dml", &["text/vnd.in3d.3dml"]), + ("3ds", &["image/x-3ds"]), + ("3g2", &["video/3gpp2"]), + ("3gp", &["video/3gpp"]), + ("3gp2", &["video/3gpp2"]), + ("3gpp", &["video/3gpp"]), + ("7z", &["application/x-7z-compressed"]), + ("aa", &["audio/audible"]), + ("aab", &["application/x-authorware-bin"]), + ("aac", &["audio/aac"]), + ("aaf", &["application/octet-stream"]), + ("aam", &["application/x-authorware-map"]), + ("aas", &["application/x-authorware-seg"]), + ("aax", &["audio/vnd.audible.aax"]), + ("abw", &["application/x-abiword"]), + ("ac", &["application/pkix-attr-cert"]), + ("ac3", &["audio/ac3"]), + ("aca", &["application/octet-stream"]), + ("acc", &["application/vnd.americandynamics.acc"]), + ("accda", &["application/msaccess.addin"]), + ("accdb", &["application/msaccess"]), + ("accdc", &["application/msaccess.cab"]), + ("accde", &["application/msaccess"]), + ("accdr", &["application/msaccess.runtime"]), + ("accdt", &["application/msaccess"]), + ("accdw", &["application/msaccess.webapplication"]), + ("accft", &["application/msaccess.ftemplate"]), + ("ace", &["application/x-ace-compressed"]), + ("acu", &["application/vnd.acucobol"]), + ("acutc", &["application/vnd.acucorp"]), + ("acx", &["application/internet-property-stream"]), + ("addin", &["text/xml"]), + ("ade", &["application/msaccess"]), + ("adobebridge", &["application/x-bridge-url"]), + ("adp", &["application/msaccess"]), + ("adt", &["audio/vnd.dlna.adts"]), + ("adts", &["audio/aac"]), + ("aep", &["application/vnd.audiograph"]), + ("afm", &["application/octet-stream"]), + ("afp", &["application/vnd.ibm.modcap"]), + ("ahead", &["application/vnd.ahead.space"]), + ("ai", &["application/postscript"]), + ("aif", &["audio/aiff"]), + ("aifc", &["audio/aiff"]), + ("aiff", &["audio/aiff"]), + ( + "air", + &["application/vnd.adobe.air-application-installer-package+zip"], + ), + ("ait", &["application/vnd.dvb.ait"]), + ("amc", &["application/mpeg"]), + ("ami", &["application/vnd.amiga.ami"]), + ("anx", &["application/annodex"]), + ("apk", &["application/vnd.android.package-archive"]), + ("apng", &["image/apng"]), + ("appcache", &["text/cache-manifest"]), + ("application", &["application/x-ms-application"]), + ("apr", &["application/vnd.lotus-approach"]), + ("arc", &["application/x-freearc"]), + ("arj", &["application/x-arj"]), + ("art", &["image/x-jg"]), + ("arw", &["image/x-sony-arw"]), + ("asa", &["application/xml"]), + ("asax", &["application/xml"]), + ("asc", &["application/pgp-signature"]), + ("ascx", &["application/xml"]), + ("asd", &["application/octet-stream"]), + ("asf", &["video/x-ms-asf"]), + ("ashx", &["application/xml"]), + ("asi", &["application/octet-stream"]), + ("asm", &["text/plain"]), + ("asmx", &["application/xml"]), + ("aso", &["application/vnd.accpac.simply.aso"]), + ("aspx", &["application/xml"]), + ("asr", &["video/x-ms-asf"]), + ("asx", &["video/x-ms-asf"]), + ("atc", &["application/vnd.acucorp"]), + ("atom", &["application/atom+xml"]), + ("atomcat", &["application/atomcat+xml"]), + ("atomsvc", &["application/atomsvc+xml"]), + ("atx", &["application/vnd.antix.game-component"]), + ("au", &["audio/basic"]), + ("avi", &["video/x-msvideo"]), + ("avif", &["image/avif"]), + ("avifs", &["image/avif-sequence"]), + ("aw", &["application/applixware"]), + ("axa", &["audio/annodex"]), + ("axs", &["application/olescript"]), + ("axv", &["video/annodex"]), + ("azf", &["application/vnd.airzip.filesecure.azf"]), + ("azs", &["application/vnd.airzip.filesecure.azs"]), + ("azw", &["application/vnd.amazon.ebook"]), + ("bas", &["text/plain"]), + ("bat", &["application/x-msdownload"]), + ("bcpio", &["application/x-bcpio"]), + ("bdf", &["application/x-font-bdf"]), + ("bdm", &["application/vnd.syncml.dm+wbxml"]), + ("bdoc", &["application/bdoc"]), + ("bed", &["application/vnd.realvnc.bed"]), + ("bh2", &["application/vnd.fujitsu.oasysprs"]), + ("bin", &["application/octet-stream"]), + ("blb", &["application/x-blorb"]), + ("blorb", &["application/x-blorb"]), + ("bmi", &["application/vnd.bmi"]), + ("bmp", &["image/bmp"]), + ("book", &["application/vnd.framemaker"]), + ("box", &["application/vnd.previewsystems.box"]), + ("boz", &["application/x-bzip2"]), + ("bpk", &["application/octet-stream"]), + ("btif", &["image/prs.btif"]), + ("buffer", &["application/octet-stream"]), + ("bz", &["application/x-bzip"]), + ("bz2", &["application/x-bzip2"]), + ("c", &["text/plain"]), + ("c11amc", &["application/vnd.cluetrust.cartomobile-config"]), + ( + "c11amz", + &["application/vnd.cluetrust.cartomobile-config-pkg"], + ), + ("c4d", &["application/vnd.clonk.c4group"]), + ("c4f", &["application/vnd.clonk.c4group"]), + ("c4g", &["application/vnd.clonk.c4group"]), + ("c4p", &["application/vnd.clonk.c4group"]), + ("c4u", &["application/vnd.clonk.c4group"]), + ("cab", &["application/octet-stream"]), + ("caf", &["audio/x-caf"]), + ("calx", &["application/vnd.ms-office.calx"]), + ("cap", &["application/vnd.tcpdump.pcap"]), + ("car", &["application/vnd.curl.car"]), + ("cat", &["application/vnd.ms-pki.seccat"]), + ("cb7", &["application/x-cbr"]), + ("cba", &["application/x-cbr"]), + ("cbr", &["application/x-cbr"]), + ("cbt", &["application/x-cbr"]), + ("cbz", &["application/x-cbr"]), + ("cc", &["text/plain"]), + ("cco", &["application/x-cocoa"]), + ("cct", &["application/x-director"]), + ("ccxml", &["application/ccxml+xml"]), + ("cd", &["text/plain"]), + ("cdbcmsg", &["application/vnd.contact.cmsg"]), + ("cdda", &["audio/aiff"]), + ("cdf", &["application/x-cdf"]), + ("cdkey", &["application/vnd.mediastation.cdkey"]), + ("cdmia", &["application/cdmi-capability"]), + ("cdmic", &["application/cdmi-container"]), + ("cdmid", &["application/cdmi-domain"]), + ("cdmio", &["application/cdmi-object"]), + ("cdmiq", &["application/cdmi-queue"]), + ("cdx", &["chemical/x-cdx"]), + ("cdxml", &["application/vnd.chemdraw+xml"]), + ("cdy", &["application/vnd.cinderella"]), + ("cer", &["application/x-x509-ca-cert"]), + ("cfg", &["text/plain"]), + ("cfs", &["application/x-cfs-compressed"]), + ("cgm", &["image/cgm"]), + ("chat", &["application/x-chat"]), + ("chm", &["application/vnd.ms-htmlhelp"]), + ("chrt", &["application/vnd.kde.kchart"]), + ("cif", &["chemical/x-cif"]), + ( + "cii", + &["application/vnd.anser-web-certificate-issue-initiation"], + ), + ("cil", &["application/vnd.ms-artgalry"]), + ("cla", &["application/vnd.claymore"]), + ("class", &["application/x-java-applet"]), + ("clkk", &["application/vnd.crick.clicker.keyboard"]), + ("clkp", &["application/vnd.crick.clicker.palette"]), + ("clkt", &["application/vnd.crick.clicker.template"]), + ("clkw", &["application/vnd.crick.clicker.wordbank"]), + ("clkx", &["application/vnd.crick.clicker"]), + ("clp", &["application/x-msclip"]), + ("cmc", &["application/vnd.cosmocaller"]), + ("cmd", &["text/plain"]), + ("cmdf", &["chemical/x-cmdf"]), + ("cml", &["chemical/x-cml"]), + ("cmp", &["application/vnd.yellowriver-custom-menu"]), + ("cmx", &["image/x-cmx"]), + ("cnf", &["text/plain"]), + ("cod", &["image/cis-cod"]), + ("coffee", &["text/coffeescript"]), + ("com", &["application/x-msdownload"]), + ("conf", &["text/plain"]), + ("config", &["application/xml"]), + ("contact", &["text/x-ms-contact"]), + ("coverage", &["application/xml"]), + ("cpio", &["application/x-cpio"]), + ("cpp", &["text/plain"]), + ("cpt", &["application/mac-compactpro"]), + ("cr2", &["image/x-canon-cr2"]), + ("cr3", &["image/x-canon-cr3"]), + ("crd", &["application/x-mscardfile"]), + ("crl", &["application/pkix-crl"]), + ("crt", &["application/x-x509-ca-cert"]), + ("crw", &["image/x-canon-crw"]), + ("crx", &["application/x-chrome-extension"]), + ("cryptonote", &["application/vnd.rig.cryptonote"]), + ("cs", &["text/plain"]), + ("csdproj", &["text/plain"]), + ("csh", &["application/x-csh"]), + ("csl", &["application/vnd.citationstyles.style+xml"]), + ("csml", &["chemical/x-csml"]), + ("csp", &["application/vnd.commonspace"]), + ("csproj", &["text/plain"]), + ("css", &["text/css"]), + ("cst", &["application/x-director"]), + ("csv", &["text/csv"]), + ("cu", &["application/cu-seeme"]), + ("cur", &["application/octet-stream"]), + ("curl", &["text/vnd.curl"]), + ("cww", &["application/prs.cww"]), + ("cxt", &["application/x-director"]), + ("cxx", &["text/plain"]), + ("dae", &["model/vnd.collada+xml"]), + ("daf", &["application/vnd.mobius.daf"]), + ("dart", &["application/vnd.dart"]), + ("dat", &["application/octet-stream"]), + ("dataless", &["application/vnd.fdsn.seed"]), + ("datasource", &["application/xml"]), + ("davmount", &["application/davmount+xml"]), + ("dbk", &["application/docbook+xml"]), + ("dbproj", &["text/plain"]), + ("dcr", &[ + "application/x-director", + "image/x-kodak-dcr", + ]), + ("dcurl", &["text/vnd.curl.dcurl"]), + ("dd2", &["application/vnd.oma.dd2+xml"]), + ("ddd", &["application/vnd.fujixerox.ddd"]), + ("deb", &["application/octet-stream"]), + ("def", &["text/plain"]), + ("deploy", &["application/octet-stream"]), + ("der", &["application/x-x509-ca-cert"]), + ("dfac", &["application/vnd.dreamfactory"]), + ("dgc", &["application/x-dgc-compressed"]), + ("dgml", &["application/xml"]), + ("dib", &["image/bmp"]), + ("dic", &["text/x-c"]), + ("dif", &["video/x-dv"]), + ("dir", &["application/x-director"]), + ("dis", &["application/vnd.mobius.dis"]), + ("disco", &["text/xml"]), + ( + "disposition-notification", + &["message/disposition-notification"], + ), + ("dist", &["application/octet-stream"]), + ("distz", &["application/octet-stream"]), + ("divx", &["video/divx"]), + ("djv", &["image/vnd.djvu"]), + ("djvu", &["image/vnd.djvu"]), + ("dll", &["application/x-msdownload"]), + ("dll.config", &["text/xml"]), + ("dlm", &["text/dlm"]), + ("dmg", &["application/octet-stream"]), + ("dmp", &["application/vnd.tcpdump.pcap"]), + ("dms", &["application/octet-stream"]), + ("dna", &["application/vnd.dna"]), + ("dng", &["image/x-adobe-dng"]), + ("doc", &["application/msword"]), + ( + "docm", + &["application/vnd.ms-word.document.macroEnabled.12"], + ), + ( + "docx", + &["application/vnd.openxmlformats-officedocument.wordprocessingml.document"], + ), + ("dot", &["application/msword"]), + ( + "dotm", + &["application/vnd.ms-word.template.macroEnabled.12"], + ), + ( + "dotx", + &["application/vnd.openxmlformats-officedocument.wordprocessingml.template"], + ), + ("dp", &["application/vnd.osgi.dp"]), + ("dpg", &["application/vnd.dpgraph"]), + ("dra", &["audio/vnd.dra"]), + ("dsc", &["text/prs.lines.tag"]), + ("dsp", &["application/octet-stream"]), + ("dssc", &["application/dssc+der"]), + ("dsw", &["text/plain"]), + ("dtb", &["application/x-dtbook+xml"]), + ("dtd", &["text/xml"]), + ("dts", &["audio/vnd.dts"]), + ("dtsconfig", &["text/xml"]), + ("dtshd", &["audio/vnd.dts.hd"]), + ("dump", &["application/octet-stream"]), + ("dv", &["video/x-dv"]), + ("dvb", &["video/vnd.dvb.file"]), + ("dvi", &["application/x-dvi"]), + ("dwf", &["drawing/x-dwf"]), + ("dwg", &["application/acad"]), + ("dwp", &["application/octet-stream"]), + ("dxf", &["application/x-dxf"]), + ("dxp", &["application/vnd.spotfire.dxp"]), + ("dxr", &["application/x-director"]), + ("ear", &["application/java-archive"]), + ("ecelp4800", &["audio/vnd.nuera.ecelp4800"]), + ("ecelp7470", &["audio/vnd.nuera.ecelp7470"]), + ("ecelp9600", &["audio/vnd.nuera.ecelp9600"]), + ("ecma", &["text/javascript"]), + ("edm", &["application/vnd.novadigm.edm"]), + ("edx", &["application/vnd.novadigm.edx"]), + ("efif", &["application/vnd.picsel"]), + ("ei6", &["application/vnd.pg.osasli"]), + ("elc", &["application/octet-stream"]), + ("emf", &["application/x-msmetafile"]), + ("eml", &["message/rfc822"]), + ("emma", &["application/emma+xml"]), + ("emz", &["application/octet-stream"]), + ("eol", &["audio/vnd.digital-winds"]), + ("eot", &["application/vnd.ms-fontobject"]), + ("eps", &["application/postscript"]), + ("epub", &["application/epub+zip"]), + ("erf", &[ + "application/x-endace-erf", + "image/x-epson-erf", + ]), + ("es", &["text/javascript"]), + ("es3", &["application/vnd.eszigno3+xml"]), + ("esa", &["application/vnd.osgi.subsystem"]), + ("esf", &["application/vnd.epson.esf"]), + ("et3", &["application/vnd.eszigno3+xml"]), + ("etl", &["application/etl"]), + ("etx", &["text/x-setext"]), + ("eva", &["application/x-eva"]), + ("evy", &["application/envoy"]), + ("exe", &["application/octet-stream"]), + ("exe.config", &["text/xml"]), + ("exi", &["application/exi"]), + ("ext", &["application/vnd.novadigm.ext"]), + ("ez", &["application/andrew-inset"]), + ("ez2", &["application/vnd.ezpix-album"]), + ("ez3", &["application/vnd.ezpix-package"]), + ("f", &["text/x-fortran"]), + ("f4v", &["video/x-f4v"]), + ("f77", &["text/x-fortran"]), + ("f90", &["text/x-fortran"]), + ("fbs", &["image/vnd.fastbidsheet"]), + ("fcdt", &["application/vnd.adobe.formscentral.fcdt"]), + ("fcs", &["application/vnd.isac.fcs"]), + ("fdf", &["application/vnd.fdf"]), + ("fe_launch", &["application/vnd.denovo.fcselayout-link"]), + ("feature", &["text/x-gherkin"]), + ("fg5", &["application/vnd.fujitsu.oasysgp"]), + ("fgd", &["application/x-director"]), + ("fh", &["image/x-freehand"]), + ("fh4", &["image/x-freehand"]), + ("fh5", &["image/x-freehand"]), + ("fh7", &["image/x-freehand"]), + ("fhc", &["image/x-freehand"]), + ("fif", &["application/fractals"]), + ("fig", &["application/x-xfig"]), + ("filters", &["application/xml"]), + ("fla", &["application/octet-stream"]), + ("flac", &["audio/flac"]), + ("fli", &["video/x-fli"]), + ("flo", &["application/vnd.micrografx.flo"]), + ("flr", &["x-world/x-vrml"]), + ("flv", &["video/x-flv"]), + ("flw", &["application/vnd.kde.kivio"]), + ("flx", &["text/vnd.fmi.flexstor"]), + ("fly", &["text/vnd.fly"]), + ("fm", &["application/vnd.framemaker"]), + ("fnc", &["application/vnd.frogans.fnc"]), + ("for", &["text/x-fortran"]), + ("fpx", &["image/vnd.fpx"]), + ("frame", &["application/vnd.framemaker"]), + ("fsc", &["application/vnd.fsc.weblaunch"]), + ("fsscript", &["application/fsharp-script"]), + ("fst", &["image/vnd.fst"]), + ("fsx", &["application/fsharp-script"]), + ("ftc", &["application/vnd.fluxtime.clip"]), + ( + "fti", + &["application/vnd.anser-web-funds-transfer-initiation"], + ), + ("fvt", &["video/vnd.fvt"]), + ("fxp", &["application/vnd.adobe.fxp"]), + ("fxpl", &["application/vnd.adobe.fxp"]), + ("fzs", &["application/vnd.fuzzysheet"]), + ("g2w", &["application/vnd.geoplan"]), + ("g3", &["image/g3fax"]), + ("g3w", &["application/vnd.geospace"]), + ("gac", &["application/vnd.groove-account"]), + ("gam", &["application/x-tads"]), + ("gbr", &["application/rpki-ghostbusters"]), + ("gca", &["application/x-gca-compressed"]), + ("gdl", &["model/vnd.gdl"]), + ("gdoc", &["application/vnd.google-apps.document"]), + ("gemini", &["text/gemini"]), + ("generictest", &["application/xml"]), + ("geo", &["application/vnd.dynageo"]), + ("geojson", &["application/geo+json"]), + ("gex", &["application/vnd.geometry-explorer"]), + ("ggb", &["application/vnd.geogebra.file"]), + ("ggt", &["application/vnd.geogebra.tool"]), + ("ghf", &["application/vnd.groove-help"]), + ("gif", &["image/gif"]), + ("gim", &["application/vnd.groove-identity-message"]), + ("glb", &["model/gltf-binary"]), + ("gltf", &["model/gltf+json"]), + ("gmi", &["text/gemini"]), + ("gml", &["application/gml+xml"]), + ("gmx", &["application/vnd.gmx"]), + ("gnumeric", &["application/x-gnumeric"]), + ("gph", &["application/vnd.flographit"]), + ("gpx", &["application/gpx+xml"]), + ("gqf", &["application/vnd.grafeq"]), + ("gqs", &["application/vnd.grafeq"]), + ("gram", &["application/srgs"]), + ("gramps", &["application/x-gramps-xml"]), + ("gre", &["application/vnd.geometry-explorer"]), + ("group", &["text/x-ms-group"]), + ("grv", &["application/vnd.groove-injector"]), + ("grxml", &["application/srgs+xml"]), + ("gsf", &["application/x-font-ghostscript"]), + ("gsheet", &["application/vnd.google-apps.spreadsheet"]), + ("gslides", &["application/vnd.google-apps.presentation"]), + ("gsm", &["audio/x-gsm"]), + ("gtar", &["application/x-gtar"]), + ("gtm", &["application/vnd.groove-tool-message"]), + ("gtw", &["model/vnd.gtw"]), + ("gv", &["text/vnd.graphviz"]), + ("gxf", &["application/gxf"]), + ("gxt", &["application/vnd.geonext"]), + ("gz", &["application/gzip", "application/x-gzip"]), + ("h", &["text/plain"]), + ("h261", &["video/h261"]), + ("h263", &["video/h263"]), + ("h264", &["video/h264"]), + ("hal", &["application/vnd.hal+xml"]), + ("hbci", &["application/vnd.hbci"]), + ("hbs", &["text/x-handlebars-template"]), + ("hdd", &["application/x-virtualbox-hdd"]), + ("hdf", &["application/x-hdf"]), + ("hdml", &["text/x-hdml"]), + ("hdr", &["image/vnd.radiance"]), + ("heic", &["image/heic"]), + ("heics", &["image/heic-sequence"]), + ("heif", &["image/heif"]), + ("heifs", &["image/heif-sequence"]), + ("hh", &["text/plain"]), + ("hhc", &["application/x-oleobject"]), + ("hhk", &["application/octet-stream"]), + ("hhp", &["application/octet-stream"]), + ("hjson", &["application/hjson"]), + ("hlp", &["application/winhlp"]), + ("hpgl", &["application/vnd.hp-hpgl"]), + ("hpid", &["application/vnd.hp-hpid"]), + ("hpp", &["text/plain"]), + ("hps", &["application/vnd.hp-hps"]), + ("hqx", &["application/mac-binhex40"]), + ("hta", &["application/hta"]), + ("htc", &["text/x-component"]), + ("htke", &["application/vnd.kenameaapp"]), + ("htm", &["text/html"]), + ("html", &["text/html"]), + ("htt", &["text/webviewhtml"]), + ("hvd", &["application/vnd.yamaha.hv-dic"]), + ("hvp", &["application/vnd.yamaha.hv-voice"]), + ("hvs", &["application/vnd.yamaha.hv-script"]), + ("hxa", &["application/xml"]), + ("hxc", &["application/xml"]), + ("hxd", &["application/octet-stream"]), + ("hxe", &["application/xml"]), + ("hxf", &["application/xml"]), + ("hxh", &["application/octet-stream"]), + ("hxi", &["application/octet-stream"]), + ("hxk", &["application/xml"]), + ("hxq", &["application/octet-stream"]), + ("hxr", &["application/octet-stream"]), + ("hxs", &["application/octet-stream"]), + ("hxt", &["text/html"]), + ("hxv", &["application/xml"]), + ("hxw", &["application/octet-stream"]), + ("hxx", &["text/plain"]), + ("i", &["text/plain"]), + ("i2g", &["application/vnd.intergeo"]), + ("icc", &["application/vnd.iccprofile"]), + ("ice", &["x-conference/x-cooltalk"]), + ("icm", &["application/vnd.iccprofile"]), + ("ico", &["image/x-icon"]), + ("ics", &["text/calendar"]), + ("idl", &["text/plain"]), + ("ief", &["image/ief"]), + ("ifb", &["text/calendar"]), + ("ifm", &["application/vnd.shana.informed.formdata"]), + ("iges", &["model/iges"]), + ("igl", &["application/vnd.igloader"]), + ("igm", &["application/vnd.insors.igm"]), + ("igs", &["model/iges"]), + ("igx", &["application/vnd.micrografx.igx"]), + ("iif", &["application/vnd.shana.informed.interchange"]), + ("iii", &["application/x-iphone"]), + ("img", &["application/octet-stream"]), + ("imp", &["application/vnd.accpac.simply.imp"]), + ("ims", &["application/vnd.ms-ims"]), + ("in", &["text/plain"]), + ("inc", &["text/plain"]), + ("inf", &["application/octet-stream"]), + ("ini", &["text/plain"]), + ("ink", &["application/inkml+xml"]), + ("inkml", &["application/inkml+xml"]), + ("inl", &["text/plain"]), + ("ins", &["application/x-internet-signup"]), + ("install", &["application/x-install-instructions"]), + ("iota", &["application/vnd.astraea-software.iota"]), + ("ipa", &["application/x-itunes-ipa"]), + ("ipfix", &["application/ipfix"]), + ("ipg", &["application/x-itunes-ipg"]), + ("ipk", &["application/vnd.shana.informed.package"]), + ("ipproj", &["text/plain"]), + ("ipsw", &["application/x-itunes-ipsw"]), + ("iqy", &["text/x-ms-iqy"]), + ("irm", &["application/vnd.ibm.rights-management"]), + ("irp", &["application/vnd.irepository.package+xml"]), + ("iso", &["application/octet-stream"]), + ("isp", &["application/x-internet-signup"]), + ("ite", &["application/x-itunes-ite"]), + ("itlp", &["application/x-itunes-itlp"]), + ("itms", &["application/x-itunes-itms"]), + ("itp", &["application/vnd.shana.informed.formtemplate"]), + ("itpc", &["application/x-itunes-itpc"]), + ("ivf", &["video/x-ivf"]), + ("ivp", &["application/vnd.immervision-ivp"]), + ("ivu", &["application/vnd.immervision-ivu"]), + ("jad", &["text/vnd.sun.j2me.app-descriptor"]), + ("jade", &["text/jade"]), + ("jam", &["application/vnd.jam"]), + ("jar", &["application/java-archive"]), + ("jardiff", &["application/x-java-archive-diff"]), + ("java", &["application/octet-stream"]), + ("jck", &["application/liquidmotion"]), + ("jcz", &["application/liquidmotion"]), + ("jfif", &["image/jpeg"]), + ("jisp", &["application/vnd.jisp"]), + ("jlt", &["application/vnd.hp-jlyt"]), + ("jng", &["image/x-jng"]), + ("jnlp", &["application/x-java-jnlp-file"]), + ("joda", &["application/vnd.joost.joda-archive"]), + ("jp2", &["image/jp2"]), + ("jpb", &["application/octet-stream"]), + ("jpe", &["image/jpeg"]), + ("jpeg", &["image/jpeg"]), + ("jpf", &["image/jpx"]), + ("jpg", &["image/jpeg"]), + ("jpg2", &["image/jp2"]), + ("jpgm", &["video/jpm"]), + ("jpgv", &["video/jpeg"]), + ("jpm", &["image/jpm"]), + ("jpx", &["image/jpx"]), + ("js", &["text/javascript"]), + ("jsm", &["text/javascript"]), + ("json", &["application/json"]), + ("json5", &["application/json5"]), + ("jsonld", &["application/ld+json"]), + ("jsonml", &["application/jsonml+json"]), + ("jsx", &["text/javascript"]), + ("jsxbin", &["text/plain"]), + ("jxl", &["image/jxl"]), + ("k25", &["image/x-kodak-k25"]), + ("kar", &["audio/midi"]), + ("karbon", &["application/vnd.kde.karbon"]), + ("kdc", &["image/x-kodak-kdc"]), + ("kfo", &["application/vnd.kde.kformula"]), + ("kia", &["application/vnd.kidspiration"]), + ("kml", &["application/vnd.google-earth.kml+xml"]), + ("kmz", &["application/vnd.google-earth.kmz"]), + ("kne", &["application/vnd.kinar"]), + ("knp", &["application/vnd.kinar"]), + ("kon", &["application/vnd.kde.kontour"]), + ("kpr", &["application/vnd.kde.kpresenter"]), + ("kpt", &["application/vnd.kde.kpresenter"]), + ("kpxx", &["application/vnd.ds-keypoint"]), + ("ksp", &["application/vnd.kde.kspread"]), + ("ktr", &["application/vnd.kahootz"]), + ("ktx", &["image/ktx"]), + ("ktz", &["application/vnd.kahootz"]), + ("kwd", &["application/vnd.kde.kword"]), + ("kwt", &["application/vnd.kde.kword"]), + ("lasxml", &["application/vnd.las.las+xml"]), + ("latex", &["application/x-latex"]), + ( + "lbd", + &["application/vnd.llamagraphics.life-balance.desktop"], + ), + ( + "lbe", + &["application/vnd.llamagraphics.life-balance.exchange+xml"], + ), + ("les", &["application/vnd.hhe.lesson-player"]), + ("less", &["text/less"]), + ("lha", &["application/x-lzh-compressed"]), + ("library-ms", &["application/windows-library+xml"]), + ("link66", &["application/vnd.route66.link66+xml"]), + ("list", &["text/plain"]), + ("list3820", &["application/vnd.ibm.modcap"]), + ("listafp", &["application/vnd.ibm.modcap"]), + ("lit", &["application/x-ms-reader"]), + ("litcoffee", &["text/coffeescript"]), + ("lnk", &["application/x-ms-shortcut"]), + ("loadtest", &["application/xml"]), + ("log", &["text/plain"]), + ("lostxml", &["application/lost+xml"]), + ("lpk", &["application/octet-stream"]), + ("lrf", &["application/octet-stream"]), + ("lrm", &["application/vnd.ms-lrm"]), + ("lsf", &["video/x-la-asf"]), + ("lst", &["text/plain"]), + ("lsx", &["video/x-la-asf"]), + ("ltf", &["application/vnd.frogans.ltf"]), + ("lua", &["text/x-lua"]), + ("luac", &["application/x-lua-bytecode"]), + ("lvp", &["audio/vnd.lucent.voice"]), + ("lwp", &["application/vnd.lotus-wordpro"]), + ("lzh", &["application/octet-stream"]), + ("m13", &["application/x-msmediaview"]), + ("m14", &["application/x-msmediaview"]), + ("m1v", &["video/mpeg"]), + ("m21", &["application/mp21"]), + ("m2a", &["audio/mpeg"]), + ("m2t", &["video/vnd.dlna.mpeg-tts"]), + ("m2ts", &["video/vnd.dlna.mpeg-tts"]), + ("m2v", &["video/mpeg"]), + ("m3a", &["audio/mpeg"]), + ("m3u", &["audio/x-mpegurl"]), + ("m3u8", &["audio/x-mpegurl"]), + ("m4a", &["audio/m4a"]), + ("m4b", &["audio/m4b"]), + ("m4p", &["audio/m4p"]), + ("m4r", &["audio/x-m4r"]), + ("m4u", &["video/vnd.mpegurl"]), + ("m4v", &["video/x-m4v"]), + ("ma", &["application/mathematica"]), + ("mac", &["image/x-macpaint"]), + ("mads", &["application/mads+xml"]), + ("mag", &["application/vnd.ecowin.chart"]), + ("mak", &["text/plain"]), + ("maker", &["application/vnd.framemaker"]), + ("man", &["application/x-troff-man"]), + ("manifest", &["application/x-ms-manifest"]), + ("map", &["text/plain"]), + ("mar", &["application/octet-stream"]), + ("markdown", &["text/markdown"]), + ("master", &["application/xml"]), + ("mathml", &["application/mathml+xml"]), + ("mb", &["application/mathematica"]), + ("mbk", &["application/vnd.mobius.mbk"]), + ("mbox", &["application/mbox"]), + ("mc1", &["application/vnd.medcalcdata"]), + ("mcd", &["application/vnd.mcd"]), + ("mcurl", &["text/vnd.curl.mcurl"]), + ("md", &["text/markdown", "text/x-markdown"]), + ("mda", &["application/msaccess"]), + ("mdb", &["application/x-msaccess"]), + ("mde", &["application/msaccess"]), + ("mdi", &["image/vnd.ms-modi"]), + ("mdp", &["application/octet-stream"]), + ("me", &["application/x-troff-me"]), + ("mesh", &["model/mesh"]), + ("meta4", &["application/metalink4+xml"]), + ("metalink", &["application/metalink+xml"]), + ("mets", &["application/mets+xml"]), + ("mfm", &["application/vnd.mfmp"]), + ("mfp", &["application/x-shockwave-flash"]), + ("mft", &["application/rpki-manifest"]), + ("mgp", &["application/vnd.osgeo.mapguide.package"]), + ("mgz", &["application/vnd.proteus.magazine"]), + ("mht", &["message/rfc822"]), + ("mhtml", &["message/rfc822"]), + ("mid", &["audio/mid"]), + ("midi", &["audio/mid"]), + ("mie", &["application/x-mie"]), + ("mif", &["application/vnd.mif"]), + ("mime", &["message/rfc822"]), + ("mix", &["application/octet-stream"]), + ("mj2", &["video/mj2"]), + ("mjp2", &["video/mj2"]), + ("mjs", &["application/javascript"]), + ("mk", &["text/plain"]), + ("mk3d", &["video/x-matroska"]), + ("mka", &["audio/x-matroska"]), + ("mkd", &["text/x-markdown"]), + ("mks", &["video/x-matroska"]), + ("mkv", &["video/x-matroska"]), + ("mlp", &["application/vnd.dolby.mlp"]), + ("mmd", &["application/vnd.chipnuts.karaoke-mmd"]), + ("mmf", &["application/x-smaf"]), + ("mml", &["text/mathml"]), + ("mmr", &["image/vnd.fujixerox.edmics-mmr"]), + ("mng", &["video/x-mng"]), + ("mno", &["text/xml"]), + ("mny", &["application/x-msmoney"]), + ("mobi", &["application/x-mobipocket-ebook"]), + ("mod", &["video/mpeg"]), + ("mods", &["application/mods+xml"]), + ("mov", &["video/quicktime"]), + ("movie", &["video/x-sgi-movie"]), + ("mp2", &["audio/mpeg", "video/mpeg"]), + ("mp21", &["application/mp21"]), + ("mp2a", &["audio/mpeg"]), + ("mp2v", &["video/mpeg"]), + ("mp3", &["audio/mpeg"]), + ("mp4", &["video/mp4"]), + ("mp4a", &["audio/mp4"]), + ("mp4s", &["application/mp4"]), + ("mp4v", &["video/mp4"]), + ("mpa", &["video/mpeg"]), + ("mpc", &["application/vnd.mophun.certificate"]), + ("mpd", &["application/dash+xml"]), + ("mpe", &["video/mpeg"]), + ("mpeg", &["video/mpeg"]), + ("mpf", &["application/vnd.ms-mediapackage"]), + ("mpg", &["video/mpeg"]), + ("mpg4", &["video/mp4"]), + ("mpga", &["audio/mpeg"]), + ("mpkg", &["application/vnd.apple.installer+xml"]), + ("mpm", &["application/vnd.blueice.multipass"]), + ("mpn", &["application/vnd.mophun.application"]), + ("mpp", &["application/vnd.ms-project"]), + ("mpt", &["application/vnd.ms-project"]), + ("mpv2", &["video/mpeg"]), + ("mpy", &["application/vnd.ibm.minipay"]), + ("mqv", &["video/quicktime"]), + ("mqy", &["application/vnd.mobius.mqy"]), + ("mrc", &["application/marc"]), + ("mrcx", &["application/marcxml+xml"]), + ("mrw", &["image/x-minolta-mrw"]), + ("ms", &["application/x-troff-ms"]), + ("mscml", &["application/mediaservercontrol+xml"]), + ("mseed", &["application/vnd.fdsn.mseed"]), + ("mseq", &["application/vnd.mseq"]), + ("msf", &["application/vnd.epson.msf"]), + ("msg", &["application/vnd.ms-outlook"]), + ("msh", &["model/mesh"]), + ("msi", &["application/octet-stream"]), + ("msl", &["application/vnd.mobius.msl"]), + ("msm", &["application/octet-stream"]), + ("mso", &["application/octet-stream"]), + ("msp", &["application/octet-stream"]), + ("msty", &["application/vnd.muvee.style"]), + ("mts", &["video/vnd.dlna.mpeg-tts"]), + ("mtx", &["application/xml"]), + ("mus", &["application/vnd.musician"]), + ("musicxml", &["application/vnd.recordare.musicxml+xml"]), + ("mvb", &["application/x-msmediaview"]), + ("mvc", &["application/x-miva-compiled"]), + ("mwf", &["application/vnd.mfer"]), + ("mxf", &["application/mxf"]), + ("mxl", &["application/vnd.recordare.musicxml"]), + ("mxml", &["application/xv+xml"]), + ("mxp", &["application/x-mmxp"]), + ("mxs", &["application/vnd.triscape.mxs"]), + ("mxu", &["video/vnd.mpegurl"]), + ("n-gage", &["application/vnd.nokia.n-gage.symbian.install"]), + ("n3", &["text/n3"]), + ("nb", &["application/mathematica"]), + ("nbp", &["application/vnd.wolfram.player"]), + ("nc", &["application/x-netcdf"]), + ("ncx", &["application/x-dtbncx+xml"]), + ("nef", &["image/x-nikon-nef"]), + ("nfo", &["text/x-nfo"]), + ("ngdat", &["application/vnd.nokia.n-gage.data"]), + ("nitf", &["application/vnd.nitf"]), + ("nlu", &["application/vnd.neurolanguage.nlu"]), + ("nml", &["application/vnd.enliven"]), + ("nnd", &["application/vnd.noblenet-directory"]), + ("nns", &["application/vnd.noblenet-sealer"]), + ("nnw", &["application/vnd.noblenet-web"]), + ("npx", &["image/vnd.net-fpx"]), + ("nq", &["application/n-quads"]), + ("nrw", &["image/x-nikon-nrw"]), + ("nsc", &["video/x-ms-asf"]), + ("nsf", &["application/vnd.lotus-notes"]), + ("nt", &["application/n-triples"]), + ("ntf", &["application/vnd.nitf"]), + ("nws", &["message/rfc822"]), + ("nzb", &["application/x-nzb"]), + ("oa2", &["application/vnd.fujitsu.oasys2"]), + ("oa3", &["application/vnd.fujitsu.oasys3"]), + ("oas", &["application/vnd.fujitsu.oasys"]), + ("obd", &["application/x-msbinder"]), + ("obj", &["application/x-tgif"]), + ("ocx", &["application/octet-stream"]), + ("oda", &["application/oda"]), + ("odb", &["application/vnd.oasis.opendocument.database"]), + ("odc", &["application/vnd.oasis.opendocument.chart"]), + ("odf", &["application/vnd.oasis.opendocument.formula"]), + ( + "odft", + &["application/vnd.oasis.opendocument.formula-template"], + ), + ("odg", &["application/vnd.oasis.opendocument.graphics"]), + ("odh", &["text/plain"]), + ("odi", &["application/vnd.oasis.opendocument.image"]), + ("odl", &["text/plain"]), + ("odm", &["application/vnd.oasis.opendocument.text-master"]), + ("odp", &["application/vnd.oasis.opendocument.presentation"]), + ("ods", &["application/vnd.oasis.opendocument.spreadsheet"]), + ("odt", &["application/vnd.oasis.opendocument.text"]), + ("oga", &["audio/ogg"]), + ("ogg", &["audio/ogg"]), + ("ogv", &["video/ogg"]), + ("ogx", &["application/ogg"]), + ("omdoc", &["application/omdoc+xml"]), + ("one", &["application/onenote"]), + ("onea", &["application/onenote"]), + ("onepkg", &["application/onenote"]), + ("onetmp", &["application/onenote"]), + ("onetoc", &["application/onenote"]), + ("onetoc2", &["application/onenote"]), + ("opf", &["application/oebps-package+xml"]), + ("opml", &["text/x-opml"]), + ("oprc", &["application/vnd.palm"]), + ("opus", &["audio/ogg"]), + ("orderedtest", &["application/xml"]), + ("orf", &["image/x-olympus-orf"]), + ("org", &["application/vnd.lotus-organizer"]), + ("osdx", &["application/opensearchdescription+xml"]), + ("osf", &["application/vnd.yamaha.openscoreformat"]), + ( + "osfpvg", + &["application/vnd.yamaha.openscoreformat.osfpvg+xml"], + ), + ( + "otc", + &["application/vnd.oasis.opendocument.chart-template"], + ), + ("otf", &["application/font-sfnt"]), + ( + "otg", + &["application/vnd.oasis.opendocument.graphics-template"], + ), + ("oth", &["application/vnd.oasis.opendocument.text-web"]), + ( + "oti", + &["application/vnd.oasis.opendocument.image-template"], + ), + ( + "otp", + &["application/vnd.oasis.opendocument.presentation-template"], + ), + ( + "ots", + &["application/vnd.oasis.opendocument.spreadsheet-template"], + ), + ("ott", &["application/vnd.oasis.opendocument.text-template"]), + ("ova", &["application/x-virtualbox-ova"]), + ("ovf", &["application/x-virtualbox-ovf"]), + ("oxps", &["application/oxps"]), + ("oxt", &["application/vnd.openofficeorg.extension"]), + ("p", &["text/x-pascal"]), + ("p10", &["application/pkcs10"]), + ("p12", &["application/x-pkcs12"]), + ("p7b", &["application/x-pkcs7-certificates"]), + ("p7c", &["application/pkcs7-mime"]), + ("p7m", &["application/pkcs7-mime"]), + ("p7r", &["application/x-pkcs7-certreqresp"]), + ("p7s", &["application/pkcs7-signature"]), + ("p8", &["application/pkcs8"]), + ("pac", &["application/x-ns-proxy-autoconfig"]), + ("parquet", &["application/vnd.apache.parquet", "application/x-parquet"]), + ("pas", &["text/x-pascal"]), + ("paw", &["application/vnd.pawaafile"]), + ("pbd", &["application/vnd.powerbuilder6"]), + ("pbm", &["image/x-portable-bitmap"]), + ("pcap", &["application/vnd.tcpdump.pcap"]), + ("pcast", &["application/x-podcast"]), + ("pcf", &["application/x-font-pcf"]), + ("pcl", &["application/vnd.hp-pcl"]), + ("pclxl", &["application/vnd.hp-pclxl"]), + ("pct", &["image/pict"]), + ("pcurl", &["application/vnd.curl.pcurl"]), + ("pcx", &["application/octet-stream"]), + ("pcz", &["application/octet-stream"]), + ("pdb", &["application/vnd.palm"]), + ("pde", &["text/x-processing"]), + ("pdf", &["application/pdf"]), + ("pef", &["image/x-pentax-pef"]), + ("pem", &["application/x-x509-ca-cert"]), + ("pfa", &["application/x-font-type1"]), + ("pfb", &["application/octet-stream"]), + ("pfm", &["application/octet-stream"]), + ("pfr", &["application/font-tdpfr"]), + ("pfx", &["application/x-pkcs12"]), + ("pgm", &["image/x-portable-graymap"]), + ("pgn", &["application/x-chess-pgn"]), + ("pgp", &["application/pgp-encrypted"]), + ("php", &["application/x-httpd-php"]), + ("pic", &["image/pict"]), + ("pict", &["image/pict"]), + ("pkg", &["application/octet-stream"]), + ("pkgdef", &["text/plain"]), + ("pkgundef", &["text/plain"]), + ("pki", &["application/pkixcmp"]), + ("pkipath", &["application/pkix-pkipath"]), + ("pko", &["application/vnd.ms-pki.pko"]), + ("pkpass", &["application/vnd.apple.pkpass"]), + ("pl", &["application/x-perl"]), + ("plb", &["application/vnd.3gpp.pic-bw-large"]), + ("plc", &["application/vnd.mobius.plc"]), + ("plf", &["application/vnd.pocketlearn"]), + ("pls", &["audio/scpls"]), + ("pm", &["application/x-perl"]), + ("pma", &["application/x-perfmon"]), + ("pmc", &["application/x-perfmon"]), + ("pml", &["application/x-perfmon"]), + ("pmr", &["application/x-perfmon"]), + ("pmw", &["application/x-perfmon"]), + ("png", &["image/png"]), + ("pnm", &["image/x-portable-anymap"]), + ("pnt", &["image/x-macpaint"]), + ("pntg", &["image/x-macpaint"]), + ("pnz", &["image/png"]), + ("portpkg", &["application/vnd.macports.portpkg"]), + ("pot", &["application/vnd.ms-powerpoint"]), + ( + "potm", + &["application/vnd.ms-powerpoint.template.macroEnabled.12"], + ), + ( + "potx", + &["application/vnd.openxmlformats-officedocument.presentationml.template"], + ), + ("ppa", &["application/vnd.ms-powerpoint"]), + ( + "ppam", + &["application/vnd.ms-powerpoint.addin.macroEnabled.12"], + ), + ("ppd", &["application/vnd.cups-ppd"]), + ("ppm", &["image/x-portable-pixmap"]), + ("pps", &["application/vnd.ms-powerpoint"]), + ( + "ppsm", + &["application/vnd.ms-powerpoint.slideshow.macroEnabled.12"], + ), + ( + "ppsx", + &["application/vnd.openxmlformats-officedocument.presentationml.slideshow"], + ), + ("ppt", &["application/vnd.ms-powerpoint"]), + ( + "pptm", + &["application/vnd.ms-powerpoint.presentation.macroEnabled.12"], + ), + ( + "pptx", + &["application/vnd.openxmlformats-officedocument.presentationml.presentation"], + ), + ("pqa", &["application/vnd.palm"]), + ("prc", &["application/x-mobipocket-ebook"]), + ("pre", &["application/vnd.lotus-freelance"]), + ("prf", &["application/pics-rules"]), + ("prm", &["application/octet-stream"]), + ("prx", &["application/octet-stream"]), + ("ps", &["application/postscript"]), + ("psb", &["application/vnd.3gpp.pic-bw-small"]), + ("psc1", &["application/PowerShell"]), + ("psd", &["application/octet-stream"]), + ("psess", &["application/xml"]), + ("psf", &["application/x-font-linux-psf"]), + ("pskcxml", &["application/pskc+xml"]), + ("psm", &["application/octet-stream"]), + ("psp", &["application/octet-stream"]), + ("pst", &["application/vnd.ms-outlook"]), + ("ptid", &["application/vnd.pvi.ptid1"]), + ("pub", &["application/x-mspublisher"]), + ("pvb", &["application/vnd.3gpp.pic-bw-var"]), + ("pwn", &["application/vnd.3m.post-it-notes"]), + ("pwz", &["application/vnd.ms-powerpoint"]), + ("py", &["text/plain"]), + ("pya", &["audio/vnd.ms-playready.media.pya"]), + ("pyv", &["video/vnd.ms-playready.media.pyv"]), + ("qam", &["application/vnd.epson.quickanime"]), + ("qbo", &["application/vnd.intu.qbo"]), + ("qfx", &["application/vnd.intu.qfx"]), + ("qht", &["text/x-html-insertion"]), + ("qhtm", &["text/x-html-insertion"]), + ("qps", &["application/vnd.publishare-delta-tree"]), + ("qt", &["video/quicktime"]), + ("qti", &["image/x-quicktime"]), + ("qtif", &["image/x-quicktime"]), + ("qtl", &["application/x-quicktimeplayer"]), + ("qwd", &["application/vnd.quark.quarkxpress"]), + ("qwt", &["application/vnd.quark.quarkxpress"]), + ("qxb", &["application/vnd.quark.quarkxpress"]), + ("qxd", &["application/octet-stream"]), + ("qxl", &["application/vnd.quark.quarkxpress"]), + ("qxt", &["application/vnd.quark.quarkxpress"]), + ("ra", &["audio/x-pn-realaudio"]), + ("raf", &["image/x-fuji-raf"]), + ("ram", &["audio/x-pn-realaudio"]), + ("raml", &["application/raml+yaml"]), + ("rar", &["application/x-rar-compressed"]), + ("ras", &["image/x-cmu-raster"]), + ("rat", &["application/rat-file"]), + ("raw", &["image/x-panasonic-rw"]), + ("rc", &["text/plain"]), + ("rc2", &["text/plain"]), + ("rcprofile", &["application/vnd.ipunplugged.rcprofile"]), + ("rct", &["text/plain"]), + ("rdf", &["application/rdf+xml"]), + ("rdlc", &["application/xml"]), + ("rdz", &["application/vnd.data-vision.rdz"]), + ("reg", &["text/plain"]), + ("rep", &["application/vnd.businessobjects"]), + ("res", &["application/x-dtbresource+xml"]), + ("resx", &["application/xml"]), + ("rf", &["image/vnd.rn-realflash"]), + ("rgb", &["image/x-rgb"]), + ("rgs", &["text/plain"]), + ("rif", &["application/reginfo+xml"]), + ("rip", &["audio/vnd.rip"]), + ("ris", &["application/x-research-info-systems"]), + ("rl", &["application/resource-lists+xml"]), + ("rlc", &["image/vnd.fujixerox.edmics-rlc"]), + ("rld", &["application/resource-lists-diff+xml"]), + ("rm", &["application/vnd.rn-realmedia"]), + ("rmi", &["audio/mid"]), + ("rmp", &["application/vnd.rn-rn_music_package"]), + ("rms", &["application/vnd.jcp.javame.midlet-rms"]), + ("rmvb", &["application/vnd.rn-realmedia-vbr"]), + ("rnc", &["application/relax-ng-compact-syntax"]), + ("rng", &["application/xml"]), + ("roa", &["application/rpki-roa"]), + ("roff", &["application/x-troff"]), + ("rp9", &["application/vnd.cloanto.rp9"]), + ("rpm", &["audio/x-pn-realaudio-plugin"]), + ("rpss", &["application/vnd.nokia.radio-presets"]), + ("rpst", &["application/vnd.nokia.radio-preset"]), + ("rq", &["application/sparql-query"]), + ("rqy", &["text/x-ms-rqy"]), + ("rs", &["text/x-rust"]), + ("rsd", &["application/rsd+xml"]), + ("rss", &["application/rss+xml"]), + ("rtf", &["application/rtf"]), + ("rtx", &["text/richtext"]), + ("ruleset", &["application/xml"]), + ("run", &["application/x-makeself"]), + ("rvt", &["application/octet-stream"]), + ("rw2", &["image/x-panasonic-rw2"]), + ("rwl", &["image/x-panasonic-rw2"]), + ("s", &["text/plain"]), + ("s3m", &["audio/s3m"]), + ("saf", &["application/vnd.yamaha.smaf-audio"]), + ("safariextz", &["application/x-safari-safariextz"]), + ("sass", &["text/x-sass"]), + ("sbml", &["application/sbml+xml"]), + ("sc", &["application/vnd.ibm.secure-container"]), + ("scd", &["application/x-msschedule"]), + ("scm", &["application/vnd.lotus-screencam"]), + ("scq", &["application/scvp-cv-request"]), + ("scr", &["text/plain"]), + ("scs", &["application/scvp-cv-response"]), + ("scss", &["text/x-scss"]), + ("sct", &["text/scriptlet"]), + ("scurl", &["text/vnd.curl.scurl"]), + ("sd2", &["audio/x-sd2"]), + ("sda", &["application/vnd.stardivision.draw"]), + ("sdc", &["application/vnd.stardivision.calc"]), + ("sdd", &["application/vnd.stardivision.impress"]), + ("sdkd", &["application/vnd.solent.sdkm+xml"]), + ("sdkm", &["application/vnd.solent.sdkm+xml"]), + ("sdp", &["application/sdp"]), + ("sdw", &["application/vnd.stardivision.writer"]), + ("sea", &["application/octet-stream"]), + ( + "searchconnector-ms", + &["application/windows-search-connector+xml"], + ), + ("see", &["application/vnd.seemail"]), + ("seed", &["application/vnd.fdsn.seed"]), + ("sema", &["application/vnd.sema"]), + ("semd", &["application/vnd.semd"]), + ("semf", &["application/vnd.semf"]), + ("ser", &["application/java-serialized-object"]), + ("setpay", &["application/set-payment-initiation"]), + ("setreg", &["application/set-registration-initiation"]), + ("settings", &["application/xml"]), + ("sfd-hdstx", &["application/vnd.hydrostatix.sof-data"]), + ("sfs", &["application/vnd.spotfire.sfs"]), + ("sfv", &["text/x-sfv"]), + ("sgi", &["image/sgi"]), + ("sgimb", &["application/x-sgimb"]), + ("sgl", &["application/vnd.stardivision.writer-global"]), + ("sgm", &["text/sgml"]), + ("sgml", &["text/sgml"]), + ("sh", &["application/x-sh"]), + ("shar", &["application/x-shar"]), + ("shex", &["text/shex"]), + ("shf", &["application/shf+xml"]), + ("shtml", &["text/html"]), + ("sid", &["image/x-mrsid-image"]), + ("sig", &["application/pgp-signature"]), + ("sil", &["audio/silk"]), + ("silo", &["model/mesh"]), + ("sis", &["application/vnd.symbian.install"]), + ("sisx", &["application/vnd.symbian.install"]), + ("sit", &["application/x-stuffit"]), + ("sitemap", &["application/xml"]), + ("sitx", &["application/x-stuffitx"]), + ("skd", &["application/vnd.koan"]), + ("skin", &["application/xml"]), + ("skm", &["application/vnd.koan"]), + ("skp", &["application/x-koan"]), + ("skt", &["application/vnd.koan"]), + ( + "sldm", + &["application/vnd.ms-powerpoint.slide.macroEnabled.12"], + ), + ( + "sldx", + &["application/vnd.openxmlformats-officedocument.presentationml.slide"], + ), + ("slim", &["text/slim"]), + ("slk", &["application/vnd.ms-excel"]), + ("slm", &["text/slim"]), + ("sln", &["text/plain"]), + ("slt", &["application/vnd.epson.salt"]), + ("slupkg-ms", &["application/x-ms-license"]), + ("sm", &["application/vnd.stepmania.stepchart"]), + ("smd", &["audio/x-smd"]), + ("smf", &["application/vnd.stardivision.math"]), + ("smi", &["application/octet-stream"]), + ("smil", &["application/smil+xml"]), + ("smv", &["video/x-smv"]), + ("smx", &["audio/x-smd"]), + ("smz", &["audio/x-smd"]), + ("smzip", &["application/vnd.stepmania.package"]), + ("snd", &["audio/basic"]), + ("snf", &["application/x-font-snf"]), + ("snippet", &["application/xml"]), + ("snp", &["application/octet-stream"]), + ("so", &["application/octet-stream"]), + ("sol", &["text/plain"]), + ("sor", &["text/plain"]), + ("spc", &["application/x-pkcs7-certificates"]), + ("spf", &["application/vnd.yamaha.smaf-phrase"]), + ("spl", &["application/futuresplash"]), + ("spot", &["text/vnd.in3d.spot"]), + ("spp", &["application/scvp-vp-response"]), + ("spq", &["application/scvp-vp-request"]), + ("spx", &["audio/ogg"]), + ("sql", &["application/x-sql"]), + ("sr2", &["image/x-sony-sr2"]), + ("src", &["application/x-wais-source"]), + ("srf", &[ + "text/plain", + "image/x-sony-srf" + ]), + ("srt", &["application/x-subrip"]), + ("sru", &["application/sru+xml"]), + ("srx", &["application/sparql-results+xml"]), + ("ssdl", &["application/ssdl+xml"]), + ("sse", &["application/vnd.kodak-descriptor"]), + ("ssf", &["application/vnd.epson.ssf"]), + ("ssisdeploymentmanifest", &["text/xml"]), + ("ssm", &["application/streamingmedia"]), + ("ssml", &["application/ssml+xml"]), + ("sst", &["application/vnd.ms-pki.certstore"]), + ("st", &["application/vnd.sailingtracker.track"]), + ("stc", &["application/vnd.sun.xml.calc.template"]), + ("std", &["application/vnd.sun.xml.draw.template"]), + ("step", &["application/step"]), + ("stf", &["application/vnd.wt.stf"]), + ("sti", &["application/vnd.sun.xml.impress.template"]), + ("stk", &["application/hyperstudio"]), + ("stl", &["application/vnd.ms-pki.stl"]), + ("stp", &["application/step"]), + ("str", &["application/vnd.pg.format"]), + ("stw", &["application/vnd.sun.xml.writer.template"]), + ("styl", &["text/stylus"]), + ("stylus", &["text/stylus"]), + ("sub", &["text/vnd.dvb.subtitle"]), + ("sus", &["application/vnd.sus-calendar"]), + ("susp", &["application/vnd.sus-calendar"]), + ("sv4cpio", &["application/x-sv4cpio"]), + ("sv4crc", &["application/x-sv4crc"]), + ("svc", &["application/xml"]), + ("svd", &["application/vnd.svd"]), + ("svg", &["image/svg+xml"]), + ("svgz", &["image/svg+xml"]), + ("swa", &["application/x-director"]), + ("swf", &["application/x-shockwave-flash"]), + ("swi", &["application/vnd.aristanetworks.swi"]), + ("sxc", &["application/vnd.sun.xml.calc"]), + ("sxd", &["application/vnd.sun.xml.draw"]), + ("sxg", &["application/vnd.sun.xml.writer.global"]), + ("sxi", &["application/vnd.sun.xml.impress"]), + ("sxm", &["application/vnd.sun.xml.math"]), + ("sxw", &["application/vnd.sun.xml.writer"]), + ("t", &["application/x-troff"]), + ("t3", &["application/x-t3vm-image"]), + ("taglet", &["application/vnd.mynfc"]), + ("tao", &["application/vnd.tao.intent-module-archive"]), + ("tar", &["application/x-tar"]), + ("tcap", &["application/vnd.3gpp2.tcap"]), + ("tcl", &["application/x-tcl"]), + ("teacher", &["application/vnd.smart.teacher"]), + ("tei", &["application/tei+xml"]), + ("teicorpus", &["application/tei+xml"]), + ("testrunconfig", &["application/xml"]), + ("testsettings", &["application/xml"]), + ("tex", &["application/x-tex"]), + ("texi", &["application/x-texinfo"]), + ("texinfo", &["application/x-texinfo"]), + ("text", &["text/plain"]), + ("tfi", &["application/thraud+xml"]), + ("tfm", &["application/x-tex-tfm"]), + ("tga", &["image/x-tga"]), + ("tgz", &["application/x-compressed"]), + ("thmx", &["application/vnd.ms-officetheme"]), + ("thn", &["application/octet-stream"]), + ("tif", &["image/tiff"]), + ("tiff", &["image/tiff"]), + ("tk", &["application/x-tcl"]), + ("tlh", &["text/plain"]), + ("tli", &["text/plain"]), + ("tmo", &["application/vnd.tmobile-livetv"]), + ("toc", &["application/octet-stream"]), + ("toml", &["text/x-toml"]), + ("torrent", &["application/x-bittorrent"]), + ("tpl", &["application/vnd.groove-tool-template"]), + ("tpt", &["application/vnd.trid.tpt"]), + ("tr", &["application/x-troff"]), + ("tra", &["application/vnd.trueapp"]), + ("trig", &["application/trig"]), + ("trm", &["application/x-msterminal"]), + ("trx", &["application/xml"]), + ("ts", &["video/vnd.dlna.mpeg-tts"]), + ("tsd", &["application/timestamped-data"]), + ("tsv", &["text/tab-separated-values"]), + ("ttc", &["font/collection"]), + ("ttf", &["font/ttf", "application/x-font-ttf", "application/font-sfnt"]), + ("ttl", &["text/turtle"]), + ("tts", &["video/vnd.dlna.mpeg-tts"]), + ("twd", &["application/vnd.simtech-mindmapper"]), + ("twds", &["application/vnd.simtech-mindmapper"]), + ("txd", &["application/vnd.genomatix.tuxedo"]), + ("txf", &["application/vnd.mobius.txf"]), + ("txt", &["text/plain"]), + ("u32", &["application/octet-stream"]), + ("u8dsn", &["message/global-delivery-status"]), + ("u8hdr", &["message/global-headers"]), + ("u8mdn", &["message/global-disposition-notification"]), + ("u8msg", &["message/global"]), + ("udeb", &["application/x-debian-package"]), + ("ufd", &["application/vnd.ufdl"]), + ("ufdl", &["application/vnd.ufdl"]), + ("uls", &["text/iuls"]), + ("ulx", &["application/x-glulx"]), + ("umj", &["application/vnd.umajin"]), + ("unityweb", &["application/vnd.unity"]), + ("uoml", &["application/vnd.uoml+xml"]), + ("uri", &["text/uri-list"]), + ("uris", &["text/uri-list"]), + ("urls", &["text/uri-list"]), + ("user", &["text/plain"]), + ("ustar", &["application/x-ustar"]), + ("utz", &["application/vnd.uiq.theme"]), + ("uu", &["text/x-uuencode"]), + ("uva", &["audio/vnd.dece.audio"]), + ("uvd", &["application/vnd.dece.data"]), + ("uvf", &["application/vnd.dece.data"]), + ("uvg", &["image/vnd.dece.graphic"]), + ("uvh", &["video/vnd.dece.hd"]), + ("uvi", &["image/vnd.dece.graphic"]), + ("uvm", &["video/vnd.dece.mobile"]), + ("uvp", &["video/vnd.dece.pd"]), + ("uvs", &["video/vnd.dece.sd"]), + ("uvt", &["application/vnd.dece.ttml+xml"]), + ("uvu", &["video/vnd.uvvu.mp4"]), + ("uvv", &["video/vnd.dece.video"]), + ("uvva", &["audio/vnd.dece.audio"]), + ("uvvd", &["application/vnd.dece.data"]), + ("uvvf", &["application/vnd.dece.data"]), + ("uvvg", &["image/vnd.dece.graphic"]), + ("uvvh", &["video/vnd.dece.hd"]), + ("uvvi", &["image/vnd.dece.graphic"]), + ("uvvm", &["video/vnd.dece.mobile"]), + ("uvvp", &["video/vnd.dece.pd"]), + ("uvvs", &["video/vnd.dece.sd"]), + ("uvvt", &["application/vnd.dece.ttml+xml"]), + ("uvvu", &["video/vnd.uvvu.mp4"]), + ("uvvv", &["video/vnd.dece.video"]), + ("uvvx", &["application/vnd.dece.unspecified"]), + ("uvvz", &["application/vnd.dece.zip"]), + ("uvx", &["application/vnd.dece.unspecified"]), + ("uvz", &["application/vnd.dece.zip"]), + ("vb", &["text/plain"]), + ("vbdproj", &["text/plain"]), + ("vbk", &["video/mpeg"]), + ("vbox", &["application/x-virtualbox-vbox"]), + ("vbox-extpack", &["application/x-virtualbox-vbox-extpack"]), + ("vbproj", &["text/plain"]), + ("vbs", &["text/vbscript"]), + ("vcard", &["text/vcard"]), + ("vcd", &["application/x-cdlink"]), + ("vcf", &["text/x-vcard"]), + ("vcg", &["application/vnd.groove-vcard"]), + ("vcproj", &["application/xml"]), + ("vcs", &["text/plain"]), + ("vcx", &["application/vnd.vcx"]), + ("vcxproj", &["application/xml"]), + ("vddproj", &["text/plain"]), + ("vdi", &["application/x-virtualbox-vdi"]), + ("vdp", &["text/plain"]), + ("vdproj", &["text/plain"]), + ("vdx", &["application/vnd.ms-visio.viewer"]), + ("vhd", &["application/x-virtualbox-vhd"]), + ("vis", &["application/vnd.visionary"]), + ("viv", &["video/vnd.vivo"]), + ("vmdk", &["application/x-virtualbox-vmdk"]), + ("vml", &["text/xml"]), + ("vob", &["video/x-ms-vob"]), + ("vor", &["application/vnd.stardivision.writer"]), + ("vox", &["application/x-authorware-bin"]), + ("vrml", &["model/vrml"]), + ("vscontent", &["application/xml"]), + ("vsct", &["text/xml"]), + ("vsd", &["application/vnd.visio"]), + ("vsf", &["application/vnd.vsf"]), + ("vsi", &["application/ms-vsi"]), + ("vsix", &["application/vsix"]), + ("vsixlangpack", &["text/xml"]), + ("vsixmanifest", &["text/xml"]), + ("vsmdi", &["application/xml"]), + ("vspscc", &["text/plain"]), + ("vss", &["application/vnd.visio"]), + ("vsscc", &["text/plain"]), + ("vssettings", &["text/xml"]), + ("vssscc", &["text/plain"]), + ("vst", &["application/vnd.visio"]), + ("vstemplate", &["text/xml"]), + ("vsto", &["application/x-ms-vsto"]), + ("vsw", &["application/vnd.visio"]), + ("vsx", &["application/vnd.visio"]), + ("vtt", &["text/vtt"]), + ("vtu", &["model/vnd.vtu"]), + ("vtx", &["application/vnd.visio"]), + ("vxml", &["application/voicexml+xml"]), + ("w3d", &["application/x-director"]), + ("wad", &["application/x-doom"]), + ("wadl", &["application/vnd.sun.wadl+xml"]), + ("war", &["application/java-archive"]), + ("wasm", &["application/wasm"]), + ("wav", &["audio/wav"]), + ("wave", &["audio/wav"]), + ("wax", &["audio/x-ms-wax"]), + ("wbk", &["application/msword"]), + ("wbmp", &["image/vnd.wap.wbmp"]), + ("wbs", &["application/vnd.criticaltools.wbs+xml"]), + ("wbxml", &["application/vnd.wap.wbxml"]), + ("wcm", &["application/vnd.ms-works"]), + ("wdb", &["application/vnd.ms-works"]), + ("wdp", &["image/vnd.ms-photo"]), + ("weba", &["audio/webm"]), + ("webapp", &["application/x-web-app-manifest+json"]), + ("webarchive", &["application/x-safari-webarchive"]), + ("webm", &["video/webm"]), + ("webmanifest", &["application/manifest+json"]), + ("webp", &["image/webp"]), + ("webtest", &["application/xml"]), + ("wg", &["application/vnd.pmi.widget"]), + ("wgt", &["application/widget"]), + ("wiq", &["application/xml"]), + ("wiz", &["application/msword"]), + ("wks", &["application/vnd.ms-works"]), + ("wlmp", &["application/wlmoviemaker"]), + ("wlpginstall", &["application/x-wlpg-detect"]), + ("wlpginstall3", &["application/x-wlpg3-detect"]), + ("wm", &["video/x-ms-wm"]), + ("wma", &["audio/x-ms-wma"]), + ("wmd", &["application/x-ms-wmd"]), + ("wmf", &["application/x-msmetafile"]), + ("wml", &["text/vnd.wap.wml"]), + ("wmlc", &["application/vnd.wap.wmlc"]), + ("wmls", &["text/vnd.wap.wmlscript"]), + ("wmlsc", &["application/vnd.wap.wmlscriptc"]), + ("wmp", &["video/x-ms-wmp"]), + ("wmv", &["video/x-ms-wmv"]), + ("wmx", &["video/x-ms-wmx"]), + ("wmz", &["application/x-ms-wmz"]), + ("woff", &["application/font-woff"]), + ("woff2", &["font/woff2"]), + ("wpd", &["application/vnd.wordperfect"]), + ("wpl", &["application/vnd.ms-wpl"]), + ("wps", &["application/vnd.ms-works"]), + ("wqd", &["application/vnd.wqd"]), + ("wri", &["application/x-mswrite"]), + ("wrl", &["x-world/x-vrml"]), + ("wrz", &["x-world/x-vrml"]), + ("wsc", &["text/scriptlet"]), + ("wsdl", &["text/xml"]), + ("wspolicy", &["application/wspolicy+xml"]), + ("wtb", &["application/vnd.webturbo"]), + ("wvx", &["video/x-ms-wvx"]), + ("x", &["application/directx"]), + ("x32", &["application/x-authorware-bin"]), + ("x3d", &["model/x3d+xml"]), + ("x3db", &["model/x3d+binary"]), + ("x3dbz", &["model/x3d+binary"]), + ("x3dv", &["model/x3d+vrml"]), + ("x3dvz", &["model/x3d+vrml"]), + ("x3dz", &["model/x3d+xml"]), + ("x3f", &["image/x-sigma-x3f"]), + ("xaf", &["x-world/x-vrml"]), + ("xaml", &["application/xaml+xml"]), + ("xap", &["application/x-silverlight-app"]), + ("xar", &["application/vnd.xara"]), + ("xbap", &["application/x-ms-xbap"]), + ("xbd", &["application/vnd.fujixerox.docuworks.binder"]), + ("xbm", &["image/x-xbitmap"]), + ("xdf", &["application/xcap-diff+xml"]), + ("xdm", &["application/vnd.syncml.dm+xml"]), + ("xdp", &["application/vnd.adobe.xdp+xml"]), + ("xdr", &["text/plain"]), + ("xdssc", &["application/dssc+xml"]), + ("xdw", &["application/vnd.fujixerox.docuworks"]), + ("xenc", &["application/xenc+xml"]), + ("xer", &["application/patch-ops-error+xml"]), + ("xfdf", &["application/vnd.adobe.xfdf"]), + ("xfdl", &["application/vnd.xfdl"]), + ("xht", &["application/xhtml+xml"]), + ("xhtml", &["application/xhtml+xml"]), + ("xhvml", &["application/xv+xml"]), + ("xif", &["image/vnd.xiff"]), + ("xla", &["application/vnd.ms-excel"]), + ("xlam", &["application/vnd.ms-excel.addin.macroEnabled.12"]), + ("xlc", &["application/vnd.ms-excel"]), + ("xld", &["application/vnd.ms-excel"]), + ("xlf", &["application/x-xliff+xml"]), + ("xlk", &["application/vnd.ms-excel"]), + ("xll", &["application/vnd.ms-excel"]), + ("xlm", &["application/vnd.ms-excel"]), + ("xls", &["application/vnd.ms-excel"]), + ( + "xlsb", + &["application/vnd.ms-excel.sheet.binary.macroEnabled.12"], + ), + ("xlsm", &["application/vnd.ms-excel.sheet.macroEnabled.12"]), + ( + "xlsx", + &["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"], + ), + ("xlt", &["application/vnd.ms-excel"]), + ( + "xltm", + &["application/vnd.ms-excel.template.macroEnabled.12"], + ), + ( + "xltx", + &["application/vnd.openxmlformats-officedocument.spreadsheetml.template"], + ), + ("xlw", &["application/vnd.ms-excel"]), + ("xm", &["audio/xm"]), + ("xml", &["text/xml"]), + ("xmp", &["application/octet-stream"]), + ("xmta", &["application/xml"]), + ("xo", &["application/vnd.olpc-sugar"]), + ("xof", &["x-world/x-vrml"]), + ("xoml", &["text/plain"]), + ("xop", &["application/xop+xml"]), + ("xpi", &["application/x-xpinstall"]), + ("xpl", &["application/xproc+xml"]), + ("xpm", &["image/x-xpixmap"]), + ("xpr", &["application/vnd.is-xpr"]), + ("xps", &["application/vnd.ms-xpsdocument"]), + ("xpw", &["application/vnd.intercon.formnet"]), + ("xpx", &["application/vnd.intercon.formnet"]), + ("xrm-ms", &["text/xml"]), + ("xsc", &["application/xml"]), + ("xsd", &["text/xml"]), + ("xsf", &["text/xml"]), + ("xsl", &["text/xml"]), + ("xslt", &["text/xml"]), + ("xsm", &["application/vnd.syncml+xml"]), + ("xsn", &["application/octet-stream"]), + ("xspf", &["application/xspf+xml"]), + ("xss", &["application/xml"]), + ("xtp", &["application/octet-stream"]), + ("xul", &["application/vnd.mozilla.xul+xml"]), + ("xvm", &["application/xv+xml"]), + ("xvml", &["application/xv+xml"]), + ("xwd", &["image/x-xwindowdump"]), + ("xyz", &["chemical/x-xyz"]), + ("xz", &["application/x-xz"]), + ("yaml", &["text/x-yaml"]), + ("yang", &["application/yang"]), + ("yin", &["application/yin+xml"]), + ("yml", &["text/x-yaml"]), + ("ymp", &["text/x-suse-ymp"]), + ("z", &["application/x-compress"]), + ("z1", &["application/x-zmachine"]), + ("z2", &["application/x-zmachine"]), + ("z3", &["application/x-zmachine"]), + ("z4", &["application/x-zmachine"]), + ("z5", &["application/x-zmachine"]), + ("z6", &["application/x-zmachine"]), + ("z7", &["application/x-zmachine"]), + ("z8", &["application/x-zmachine"]), + ("zaz", &["application/vnd.zzazz.deck+xml"]), + ("zip", &["application/zip"]), + ("zir", &["application/vnd.zul"]), + ("zirz", &["application/vnd.zul"]), + ("zmm", &["application/vnd.handheld-entertainment+xml"]), +]; diff --git a/toolkit/components/downloads/DownloadList.sys.mjs b/toolkit/components/downloads/DownloadList.sys.mjs index c4e5776940c4..d580d193bda5 100644 --- a/toolkit/components/downloads/DownloadList.sys.mjs +++ b/toolkit/components/downloads/DownloadList.sys.mjs @@ -50,6 +50,7 @@ const FILE_EXTENSIONS = [ "jpg", "jpeg", "json", + "jxl", "m4a", "mdb", "mid", diff --git a/toolkit/components/extensions/parent/ext-downloads.js b/toolkit/components/extensions/parent/ext-downloads.js index 3b81d5e60a5e..41e6efa57caf 100644 --- a/toolkit/components/extensions/parent/ext-downloads.js +++ b/toolkit/components/extensions/parent/ext-downloads.js @@ -104,6 +104,7 @@ const FILTER_IMAGES_EXTENSIONS = [ "raw", "webp", "heic", + "jxl", ]; const FILTER_XML_EXTENSIONS = ["xml"]; diff --git a/toolkit/content/filepicker.properties b/toolkit/content/filepicker.properties index 03daec114c28..b6bd09c3c562 100644 --- a/toolkit/content/filepicker.properties +++ b/toolkit/content/filepicker.properties @@ -5,7 +5,7 @@ allFilter=* htmlFilter=*.html; *.htm; *.shtml; *.xhtml textFilter=*.txt; *.text -imageFilter=*.jpe; *.jpg; *.jpeg; *.gif; *.png; *.bmp; *.ico; *.svg; *.svgz; *.tif; *.tiff; *.ai; *.drw; *.pct; *.psp; *.xcf; *.psd; *.raw; *.webp; *.heic +imageFilter=*.jpe; *.jpg; *.jpeg; *.gif; *.png; *.bmp; *.ico; *.svg; *.svgz; *.tif; *.tiff; *.ai; *.drw; *.pct; *.psp; *.xcf; *.psd; *.raw; *.webp; *.heic; *.avif; *.jxl xmlFilter=*.xml xulFilter=*.xul audioFilter=*.aac; *.aif; *.flac; *.iff; *.m4a; *.m4b; *.mid; *.midi; *.mp3; *.mpa; *.mpc; *.oga; *.ogg; *.opus; *.ra; *.ram; *.snd; *.wav; *.wma diff --git a/toolkit/moz.configure b/toolkit/moz.configure index 7eb76b2dd020..466629f57d1b 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -932,9 +932,9 @@ set_config("MOZ_SYSTEM_AV1", True, when="--with-system-av1") option("--disable-jxl", help="Disable jxl image support") -@depends("--disable-jxl", milestone.is_nightly) -def jxl(value, is_nightly): - if is_nightly and value: +@depends("--disable-jxl") +def jxl(value): + if value: return True diff --git a/widget/gtk/nsAppShell.cpp b/widget/gtk/nsAppShell.cpp index 99fd6dc87336..b5cf7ef750a4 100644 --- a/widget/gtk/nsAppShell.cpp +++ b/widget/gtk/nsAppShell.cpp @@ -420,7 +420,8 @@ nsresult nsAppShell::Init() { gchar* name = gdk_pixbuf_format_get_name(format); if (strcmp(name, "jpeg") && strcmp(name, "png") && strcmp(name, "gif") && strcmp(name, "bmp") && strcmp(name, "ico") && strcmp(name, "xpm") && - strcmp(name, "svg") && strcmp(name, "webp") && strcmp(name, "avif")) { + strcmp(name, "svg") && strcmp(name, "webp") && strcmp(name, "avif") && + strcmp(name, "jxl")) { gdk_pixbuf_format_set_disabled(format, TRUE); } g_free(name);