fix(memory-storage): use platform basename in key-value store warning#3864
Merged
Conversation
The extension-less fallback in KeyValueFileSystemEntry.get() imported basename from node:path/win32, so on POSIX it treated a backslash in the store directory name as a path separator and truncated the store name in its warning message. Import basename from node:path like the sibling dataset and request-queue modules so the platform-correct basename is used. Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
barjin
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
KeyValueFileSystemEntry.get()in@crawlee/memory-storageimportsbasenamefrom
node:path/win32(the Windows-only path module) and uses it to build awarning when a key-value entry is read without a file extension:
path.win32.basenamealways treats\as a path separator, even on POSIX. Abackslash is a legal filename character on Linux and macOS, so if the key-value
store directory's leaf name contains one, the warning shows a wrongly truncated
store name. For a store at
.../my\weird\store, the message saysfor store storeinstead of
for store my\weird\store. Ordinary POSIX paths use/, whichpath.win32.basenamealso handles, which is why this went unnoticed.This is the only module under
packages/*/srcthat imports fromnode:path/win32; every sibling, including this same file'sdirnameand thedatasetandrequest-queuefs.tsmodules, imports the platform-awarenode:path. The fix mergesbasenameinto the existingnode:pathimport anddrops the
node:path/win32line, so the platform-correctbasenameis used:No logic changes; only the warning text is affected (the value is never used for
file I/O, real paths go through
resolveWithinDirectory).Added a regression test (
test/core/storages/key_value_store_fs.test.ts) thatdrives
get()into the extension-less fallback with a store directory whose leafname contains a backslash, spies on the warning, and asserts the full leaf name is
present. It fails before the change (
for store store) and passes after.