firebase-to-supabase
firebase-to-supabase copied to clipboard
auth: import issue when displayName includes an '
Bug report
Describe the bug
While using the auth solution in this repo, if you export a list of users to a .json and then attempt to import those users, if any user has a display name with an ' in it (example: "O'Leary"), the SQL that's generated throws an error.
To Reproduce
- Create a user in Firebase Auth with a displayName containing an apostrophe.
- Export that user to a list of users.
- Try to import that user with the
import_users.js
script - See error
Expected behavior
Import works for names with apostrophes.
I think adding a custom replacer to the JSON.stringify(user)
of something like:
function replacer(key, value) {
if (typeof value === 'string') {
return value.replace(/'/g, "''");
}
return value;
}
...
JSON.stringify(user, replacer);
would work