Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed behaviour of empty key prefix string #990

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fohletex
Copy link

Hi!

I recently stumpled upon the keyprefix-logic of localforage, when I explicitly didn't want to have a KeyPrefix in my LF instance. Avoiding to define an instance name, will lead to the issue that localforage itself sets the "localforage" prefix. Hence I did

localforage.createInstance({ name: '' });

This replaced the name field with an empty string, however e.g. the LocalStorage driver is still pre-prending a slash (/) to the keys I try to get. As it can be seen here:

var keyPrefix = options.name + '/';

I was wondering if this is a desired behaviour or not. For me it seems to be unwanted and thus I consider it being a bug. This PR will hopefully fix the issue.

I currently further maintain the ReactNative AsyncStorage Driver for LF as well as the WebExtension Storage Driver. If you also see this as a bug and accept the PR or similar I will also re-check these drivers for the same possible issue in these packages and fix if required.

@fohletex
Copy link
Author

@tofumatt @thgreasi Any updates? As far as I can see, the build-fail wasn't mine (failed already before the PR). Would be nice if you can give me some further clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant