helloadhavan/github_issues huggingface dataset:
Repository: ollama/ollama
Pull request: patch llama.cpp for 34B


Changed files:
filename: llm/llama.cpp
patch: @@ -105,6 +105,7 @@ enum e_model {
     MODEL_7B,
     MODEL_13B,
     MODEL_30B,
+    MODEL_34B,
     MODEL_65B,
     MODEL_70B,
 };
@@ -1053,6 +1054,7 @@ static const char *llama_model_type_name(e_model type) {
         case MODEL_7B: return "7B";
         case MODEL_13B: return "13B";
         case MODEL_30B: return "30B";
+        case MODEL_34B: return "34B";
         case MODEL_65B: return "65B";
         case MODEL_70B: return "70B";
         default: LLAMA_ASSERT(false);
@@ -1100,6 +1102,7 @@ static void llama_model_load_internal(
             case 26: model.type = e_model::MODEL_3B; break;
             case 32: model.type = e_model::MODEL_7B; break;
             case 40: model.type = e_model::MODEL_13B; break;
+            case 48: model.type = e_model::MODEL_34B; break;
             case 60: model.type = e_model::MODEL_30B; break;
             case 80: model.type = e_model::MODEL_65B; break;
             default:
Repository: nodejs/node
Pull request: doc: update metadata for _transformState deprecation

It seems that the deprecated `_transformState` property was removed at some point in the past but the deprecation metadata was not updated accordingly.

@ronag or @mcollina ... do you happen to know which PR and which release removed the `_transformState`?


Changed files:
filename: doc/api/deprecations.md
patch: @@ -2974,12 +2974,15 @@ upon `require('node:module').builtinModules`.
 
 <!-- YAML
 changes:
+  - version: v15.0.0
+    pr-url: https://github.com/nodejs/node/pull/33105
+    description: End-of-Life.
   - version: v14.5.0
     pr-url: https://github.com/nodejs/node/pull/33126
     description: Runtime deprecation.
 -->
 
-Type: Runtime
+Type: End-of-Life
 
 `Transform._transformState` will be removed in future versions where it is
 no longer required due to simplification of the implementation.
Repository: ollama/ollama
Pull request: add 34b model type


Changed files:
filename: llm/ggml.go
patch: @@ -15,6 +15,7 @@ const (
 	ModelType3B  ModelType = 26
 	ModelType7B  ModelType = 32
 	ModelType13B ModelType = 40
+	ModelType34B ModelType = 48
 	ModelType30B ModelType = 60
 	ModelType65B ModelType = 80
 )
@@ -27,6 +28,8 @@ func (mt ModelType) String() string {
 		return "7B"
 	case ModelType13B:
 		return "13B"
+	case ModelType34B:
+		return "34B"
 	case ModelType30B:
 		return "30B"
 	case ModelType65B:
Repository: facebook/react
Pull request: Change to content hash for RN canary VERSION strings

With this change, the different files in RN will have *different* hashes. This replaces the git hash and means that the file content (including version) is only updated when the rest of the file content actually changes. This should remove "noop" changes that need to be synced that only update the version string.

A difference to the www implementation here is (and I'd be looking at updating www as well if this lands well) that each file has an individual hash instead of a combined content hash. This further reduces the number of updated files and I couldn't find a reason we need to have these in sync. The best I can gather is that this hash is used so folks don't directly compare version string and make future updates harder.

Changed files:
filename: scripts/rollup/build-all-release-channels.js
patch: @@ -173,25 +173,17 @@ function processStable(buildDir) {
     );
   }
 
-  const reactNativeBuildDir = buildDir + '/react-native/implementations/';
-  if (fs.existsSync(reactNativeBuildDir)) {
-    const hash = crypto.createHash('sha1');
-    for (const fileName of fs.readdirSync(reactNativeBuildDir).sort()) {
-      const filePath = reactNativeBuildDir + fileName;
-      const stats = fs.statSync(filePath);
-      if (!stats.isDirectory()) {
-        hash.update(fs.readFileSync(filePath));
-      }
+  [
+    buildDir + '/react-native/implementations/',
+    buildDir + '/facebook-react-native/',
+  ].forEach(reactNativeBuildDir => {
+    if (fs.existsSync(reactNativeBuildDir)) {
+      updatePlaceholderReactVersionInCompiledArtifacts(
+        reactNativeBuildDir,
+        ReactVersion + '-' + canaryChannelLabel + '-%FILEHASH%'
+      );
     }
-    updatePlaceholderReactVersionInCompiledArtifacts(
-      reactNativeBuildDir,
-      ReactVersion +
-        '-' +
-        canaryChannelLabel +
-        '-' +
-        hash.digest('hex').slice(0, 8)
-    );
-  }
+  });
 
   // Update remaining placeholders with canary channel version
   updatePlaceholderReactVersionInCompiledArtifacts(
@@ -362,9 +354,11 @@ function updatePlaceholderReactVersionInCompiledArtifacts(
 
   for (const artifactFilename of artifactFilenames) {
     const originalText = fs.readFileSync(artifactFilename, 'utf8');
+    const fileHash = crypto.createHash('sha1');
+    fileHash.update(originalText);
     const replacedText = originalText.replaceAll(
       PLACEHOLDER_REACT_VERSION,
-      newVersion
+      newVersion.replace(/%FILEHASH%/g, fileHash.digest('hex').slice(0, 8))
     );
     fs.writeFileSync(artifactFilename, replacedText);
   }
Repository: denoland/deno
Pull request: fix(ext/node): export `promises` from stream

Closes #30423

Changed files:
filename: ext/node/polyfills/stream.ts
patch: @@ -173,6 +173,7 @@ export {
   getDefaultHighWaterMark,
   PassThrough,
   pipeline,
+  promises,
   Readable,
   setDefaultHighWaterMark,
   Stream,

filename: tests/unit_node/stream_test.ts
patch: @@ -3,7 +3,12 @@
 import { assert, assertEquals } from "@std/assert";
 import { fromFileUrl, relative } from "@std/path";
 import { finished, pipeline } from "node:stream/promises";
-import { getDefaultHighWaterMark, Stream, Writable } from "node:stream";
+import {
+  getDefaultHighWaterMark,
+  promises,
+  Stream,
+  Writable,
+} from "node:stream";
 import { TextEncoderStream } from "node:stream/web";
 import { createReadStream, createWriteStream } from "node:fs";
 import { EventEmitter } from "node:events";
@@ -78,3 +83,18 @@ Deno.test("Writable toWeb", async () => {
 
   await finished(nodeWritable);
 });
+
+// https://github.com/denoland/deno/issues/30423
+Deno.test("exported `promises` from node:stream works", async () => {
+  const stream = new ReadableStream({
+    start(controller) {
+      controller.enqueue("asd");
+      controller.close();
+    },
+  });
+  const promise = promises.finished(stream as unknown as NodeJS.ReadableStream);
+  for await (const chunk of stream) {
+    assertEquals(chunk, "asd");
+  }
+  await promise;
+});

filename: tools/core_import_map.json
patch: @@ -197,7 +197,7 @@
     "ext:deno_node/repl.ts": "../ext/node/polyfills/repl.ts",
     "node:stream": "../ext/node/polyfills/stream.ts",
     "node:stream/consumers": "../ext/node/polyfills/stream/consumers.mjs",
-    "node:stream/promises": "../ext/node/polyfills/stream/promises.mjs",
+    "node:stream/promises": "../ext/node/polyfills/stream/promises.js",
     "node:stream/web": "../ext/node/polyfills/stream/web.ts",
     "node:string_decoder": "../ext/node/polyfills/string_decoder.ts",
     "node:sys": "../ext/node/polyfills/sys.ts",
Repository: ollama/ollama
Pull request: build release mode


Changed files:
filename: scripts/build_darwin.sh
patch: @@ -3,6 +3,7 @@
 mkdir -p dist
 
 GO_LDFLAGS="-X github.com/jmorganca/ollama/version.Version=$VERSION"
+GO_LDFLAGS="$GO_LDFLAGS -X github.com/jmorganca/ollama/server.mode=release"
 
 # build universal binary
 CGO_ENABLED=1 GOARCH=arm64 go build -ldflags "$GO_LDFLAGS" -o dist/ollama-darwin-arm64

filename: server/routes.go
patch: @@ -25,6 +25,20 @@ import (
 	"github.com/jmorganca/ollama/vector"
 )
 
+var mode string = gin.DebugMode
+
+func init() {
+	switch mode {
+	case gin.DebugMode:
+	case gin.ReleaseMode:
+	case gin.TestMode:
+	default:
+		mode = gin.DebugMode
+	}
+
+	gin.SetMode(mode)
+}
+
 var loaded struct {
 	mu sync.Mutex
Repository: facebook/react
Pull request: Performance: avoid triggering map deopt in V8

The shape of the objects changed by this PR are both created in 2 locations with 2 different shapes, which most JS engines won't like. I've noticed this in particular in V8 while benchmarking production code.

https://github.com/facebook/react/blob/1293047d6063f3508af15e68cca916660ded791e/packages/react-reconciler/src/ReactFiberCacheComponent.js#L66-L77

https://github.com/facebook/react/blob/1293047d6063f3508af15e68cca916660ded791e/packages/react-reconciler/src/ReactFiberHostContext.js#L47-L54

https://github.com/facebook/react/blob/1293047d6063f3508af15e68cca916660ded791e/packages/react-reconciler/src/ReactFiberHooks.js#L3530-L3531

https://github.com/facebook/react/blob/1293047d6063f3508af15e68cca916660ded791e/packages/react-reconciler/src/ReactFiberHooks.js#L3492-L3493

Changed files:
filename: packages/react-reconciler/src/ReactFiberHooks.js
patch: @@ -3489,8 +3489,8 @@ export const ContextOnlyDispatcher: Dispatcher = {
   useContext: throwInvalidHookError,
   useEffect: throwInvalidHookError,
   useImperativeHandle: throwInvalidHookError,
-  useInsertionEffect: throwInvalidHookError,
   useLayoutEffect: throwInvalidHookError,
+  useInsertionEffect: throwInvalidHookError,
   useMemo: throwInvalidHookError,
   useReducer: throwInvalidHookError,
   useRef: throwInvalidHookError,

filename: packages/react-reconciler/src/ReactFiberHostContext.js
patch: @@ -46,11 +46,11 @@ const hostTransitionProviderCursor: StackCursor<Fiber | null> =
 // inside useHostTransitionStatus.
 export const HostTransitionContext: ReactContext<TransitionStatus | null> = {
   $$typeof: REACT_CONTEXT_TYPE,
+  Provider: (null: any),
+  Consumer: (null: any),
   _currentValue: null,
   _currentValue2: null,
   _threadCount: 0,
-  Provider: (null: any),
-  Consumer: (null: any),
 };
 
 function requiredContext<Value>(c: Value | null): Value {
Repository: vercel/next.js
Pull request: Fix generate-metadata.mdx typo

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the PR.
- Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to understand the PR)
- When linking to a Slack thread, you might want to share details of the conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Changed files:
filename: docs/01-app/03-api-reference/04-functions/generate-metadata.mdx
patch: @@ -889,7 +889,7 @@ export const metadata = {
 
 ### `facebook`
 
-You can connect a Facebook app or Facebook account to you webpage for certain Facebook Social Plugins [Facebook Documentation](https://developers.facebook.com/docs/plugins/comments/#moderation-setup-instructions)
+You can connect a Facebook app or Facebook account to your webpage for certain Facebook Social Plugins [Facebook Documentation](https://developers.facebook.com/docs/plugins/comments/#moderation-setup-instructions)
 
 > **Good to know**: You can specify either appId or admins, but not both.
Repository: nodejs/node
Pull request: stream: preserve asynclocalstorage context in finished()

Fixes #57844

Changed files:
filename: lib/internal/streams/end-of-stream.js
patch: @@ -43,6 +43,9 @@ const {
   willEmitClose: _willEmitClose,
   kIsClosedPromise,
 } = require('internal/streams/utils');
+
+// Lazy load
+let AsyncLocalStorage;
 let addAbortListener;
 
 function isRequest(stream) {
@@ -63,7 +66,8 @@ function eos(stream, options, callback) {
   validateFunction(callback, 'callback');
   validateAbortSignal(options.signal, 'options.signal');
 
-  callback = once(callback);
+  AsyncLocalStorage ??= require('async_hooks').AsyncLocalStorage;
+  callback = once(AsyncLocalStorage.bind(callback));
 
   if (isReadableStream(stream) || isWritableStream(stream)) {
     return eosWeb(stream, options, callback);

filename: test/async-hooks/test-async-local-storage-stream-finished.js
patch: @@ -0,0 +1,20 @@
+'use strict';
+
+const common = require('../common');
+const { Readable, finished } = require('stream');
+const { AsyncLocalStorage } = require('async_hooks');
+const { strictEqual } = require('assert');
+
+// This test verifies that AsyncLocalStorage context is maintained
+// when using stream.finished()
+
+const readable = new Readable();
+const als = new AsyncLocalStorage();
+
+als.run(321, () => {
+  finished(readable, common.mustCall(() => {
+    strictEqual(als.getStore(), 321);
+  }));
+});
+
+readable.destroy();
Repository: vercel/next.js
Pull request: fix: use in operator to check dev indicator option when its obj

Noticed an error when deploying an app when `devIndicators` set to true, see error below:
```
[TypeError: Cannot use 'in' operator to search for 'buildActivityPosition' in true]
```

Change to a safer condition to avoid the crash


Changed files:
filename: packages/next/src/server/config.ts
patch: @@ -585,7 +585,8 @@ function assignDefaults(
 
   // Handle buildActivityPosition migration (needs to be done after merging with defaults)
   if (
-    result.devIndicators !== false &&
+    result.devIndicators &&
+    typeof result.devIndicators === 'object' &&
     'buildActivityPosition' in result.devIndicators &&
     result.devIndicators.buildActivityPosition !== result.devIndicators.position
   ) {
Repository: huggingface/transformers
Pull request: Fix GPT-OSS `swiglu_limit` not passed in for MXFP4

`swiglu_limit = 7.0` was not passed in when doing MXFP4 inference when using OpenAI's triton_kernels library.

Changed files:
filename: src/transformers/integrations/mxfp4.py
patch: @@ -172,7 +172,7 @@ def __init__(self, config):
             torch.zeros(self.num_experts, self.hidden_size, dtype=torch.float32), requires_grad=False
         )
         self.alpha = 1.702
-
+        self.limit = getattr(config, "swiglu_limit", 7.0)
         self.gate_up_proj_precision_config = None
         self.down_proj_precision_config = None
 
@@ -185,7 +185,7 @@ def forward(self, hidden_states: torch.Tensor, routing_data, gather_idx, scatter
         swiglu_fn = triton_kernels_hub.swiglu.swiglu_fn
 
         with torch.cuda.device(hidden_states.device):
-            act = FusedActivation(FnSpecs("swiglu", swiglu_fn, ("alpha", "limit")), (self.alpha, None), 2)
+            act = FusedActivation(FnSpecs("swiglu", swiglu_fn, ("alpha", "limit")), (self.alpha, self.limit), 2)
 
             intermediate_cache1 = matmul_ogs(
                 hidden_states,
Repository: ollama/ollama
Pull request: copy metadata from source


Changed files:
filename: llm/llama.go
patch: @@ -117,7 +117,21 @@ func (llm *llamaModel) ModelFamily() ModelFamily {
 }
 
 func (llm *llamaModel) ModelType() ModelType {
-	return ModelType30B
+	switch llm.hyperparameters.NumLayer {
+	case 26:
+		return ModelType3B
+	case 32:
+		return ModelType7B
+	case 40:
+		return ModelType13B
+	case 60:
+		return ModelType30B
+	case 80:
+		return ModelType65B
+	}
+
+	// TODO: find a better default
+	return ModelType7B
 }
 
 func (llm *llamaModel) FileType() FileType {

filename: server/images.go
patch: @@ -325,7 +325,27 @@ func CreateModel(ctx context.Context, name string, path string, fn func(resp api
 			}
 
 			if mf != nil {
-				log.Printf("manifest = %#v", mf)
+				sourceBlobPath, err := GetBlobsPath(mf.Config.Digest)
+				if err != nil {
+					return err
+				}
+
+				sourceBlob, err := os.Open(sourceBlobPath)
+				if err != nil {
+					return err
+				}
+				defer sourceBlob.Close()
+
+				var source ConfigV2
+				if err := json.NewDecoder(sourceBlob).Decode(&source); err != nil {
+					return err
+				}
+
+				// copie the model metadata
+				config.ModelFamily = source.ModelFamily
+				config.ModelType = source.ModelType
+				config.FileType = source.FileType
+
 				for _, l := range mf.Layers {
 					newLayer, err := GetLayerWithBufferFromLayer(l)
 					if err != nil {
Repository: huggingface/transformers
Pull request: Remove _prepare_flash_attention_from_position_ids

# What does this PR do?

This function is deprecated and none of its use can be found.

Changed files:
filename: src/transformers/modeling_flash_attention_utils.py
patch: @@ -13,7 +13,6 @@
 # limitations under the License.
 import inspect
 import os
-import warnings
 from functools import partial
 from typing import Optional, TypedDict
 
@@ -426,14 +425,6 @@ def _prepare_from_posids(query, key, value, position_ids, query_length):
     return (query, key, value, (cu_seq_lens_q, cu_seq_lens_k), (max_length_q, max_length_k))
 
 
-def _prepare_flash_attention_from_position_ids(query, key, value, position_ids):
-    warnings.warn(
-        "The function `_prepare_flash_attention_from_position_ids` in `transformers.modeling_flash_attention_utils` is deprecated and will be removed in a future version. Please use `_prepare_from_posids` instead.",
-        FutureWarning,
-    )
-    return _prepare_from_posids(query, key, value, position_ids)
-
-
 def _is_packed_sequence(position_ids, batch_size):
     """
     Check the position ids whether packed sequences are indicated or not
Repository: denoland/deno
Pull request: fix(node/fs): cp should not create subfolder when both source and target are directories

When both source and target paths are a directory, we should do nothing. Previously, we would create a subdirectory in the target dir and copy into that.

Fixes https://github.com/denoland/deno/issues/30407

Changed files:
filename: ext/fs/std_fs.rs
patch: @@ -5,6 +5,7 @@
 use std::borrow::Cow;
 use std::fs;
 use std::io;
+use std::io::ErrorKind;
 use std::io::Read;
 use std::io::Write;
 use std::path::Path;
@@ -657,7 +658,14 @@ fn cp(from: &Path, to: &Path) -> FsResult<()> {
         use std::os::unix::fs::PermissionsExt;
         builder.mode(fs::symlink_metadata(from)?.permissions().mode());
       }
-      builder.create(to)?;
+
+      // The target directory might already exists. If it does,
+      // continue copying all entries instead of aborting.
+      if let Err(err) = builder.create(to)
+        && err.kind() != ErrorKind::AlreadyExists
+      {
+        return Err(FsError::Io(err));
+      }
 
       let mut entries: Vec<_> = fs::read_dir(from)?
         .map(|res| res.map(|e| e.file_name()))
@@ -779,16 +787,21 @@ fn cp(from: &Path, to: &Path) -> FsResult<()> {
   if let Ok(m) = fs::metadata(to)
     && m.is_dir()
   {
-    return cp_(
-      source_meta,
-      from,
-      &to.join(from.file_name().ok_or_else(|| {
-        io::Error::new(
-          io::ErrorKind::InvalidInput,
-          "the source path is not a valid file",
-        )
-      })?),
-    );
+    // Only target sub dir when source is not a dir itself
+    if let Ok(from_meta) = fs::metadata(from)
+      && !from_meta.is_dir()
+    {
+      return cp_(
+        source_meta,
+        from,
+        &to.join(from.file_name().ok_or_else(|| {
+          io::Error::new(
+            io::ErrorKind::InvalidInput,
+            "the source path is not a valid file",
+          )
+        })?),
+      );
+    }
   }
 
   if let Ok(m) = fs::symlink_metadata(to)

filename: tests/specs/node/node_fs_cp/__test__.jsonc
patch: @@ -0,0 +1,5 @@
+{
+  "args": "run --allow-write --allow-read main.mjs",
+  "output": "main.out",
+  "exitCode": 0
+}

filename: tests/specs/node/node_fs_cp/main.mjs
patch: @@ -0,0 +1,23 @@
+import fs from "node:fs/promises";
+import path from "node:path";
+
+const src = path.join(import.meta.dirname, "source");
+const target = path.join(import.meta.dirname, "dist");
+
+try {
+  await fs.rm(target, { recursive: true });
+} catch {
+  // ignore
+}
+
+await fs.cp(src, target, { recursive: true, force: true });
+await fs.cp(src, target, { recursive: true, force: true });
+
+const entries = await Array.fromAsync(await fs.readdir(target));
+console.log(entries);
+
+try {
+  await fs.rm(target, { recursive: true });
+} catch {
+  // ignore
+}

filename: tests/specs/node/node_fs_cp/main.out
patch: @@ -0,0 +1 @@
+[ "foo.txt" ]

filename: tests/specs/node/node_fs_cp/source/foo.txt
patch: @@ -0,0 +1 @@
+foo
\ No newline at end of file
Repository: electron/electron
Pull request: perf: avoid unnecessary vector copy in `GetMimeTypeToExtensionIdMap()`

Backport of #46373

See that PR for details.


Notes: none.

Changed files:
filename: shell/browser/plugins/plugin_utils.cc
patch: @@ -33,30 +33,33 @@ std::string PluginUtils::GetExtensionIdForMimeType(
 base::flat_map<std::string, std::string>
 PluginUtils::GetMimeTypeToExtensionIdMap(
     content::BrowserContext* browser_context) {
-  base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
 #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
-  std::vector<std::string> allowed_extension_ids =
-      MimeTypesHandler::GetMIMETypeAllowlist();
+  const auto& allowed_extension_ids = MimeTypesHandler::GetMIMETypeAllowlist();
+  if (allowed_extension_ids.empty())
+    return {};
+
+  const extensions::ExtensionSet& enabled_extensions =
+      extensions::ExtensionRegistry::Get(browser_context)->enabled_extensions();
+
+  base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
+
   // Go through the white-listed extensions and try to use them to intercept
   // the URL request.
-  for (const std::string& extension_id : allowed_extension_ids) {
-    const extensions::Extension* extension =
-        extensions::ExtensionRegistry::Get(browser_context)
-            ->enabled_extensions()
-            .GetByID(extension_id);
-    // The white-listed extension may not be installed, so we have to nullptr
-    // check |extension|.
-    if (!extension) {
+  for (const std::string& id : allowed_extension_ids) {
+    const extensions::Extension* extension = enabled_extensions.GetByID(id);
+    if (!extension)  // extension might not be installed, so check for nullptr
       continue;
-    }
 
-    if (MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension)) {
-      for (const auto& supported_mime_type : handler->mime_type_set()) {
-        DCHECK(!mime_type_to_extension_id_map.contains(supported_mime_type));
-        mime_type_to_extension_id_map[supported_mime_type] = extension_id;
+    if (const MimeTypesHandler* handler =
+            MimeTypesHandler::GetHandler(extension)) {
+      for (const std::string& mime_type : handler->mime_type_set()) {
+        const auto [_, inserted] =
+            mime_type_to_extension_id_map.insert_or_assign(mime_type, id);
+        DCHECK(inserted);
       }
     }
   }
 #endif
+
   return mime_type_to_extension_id_map;
 }