Fix legacy name prefix removal using wrong variable in bookmarks Fixes leftover bug from #4993. In both `getBookmarkName` and `createBranch`, the second regex replacement was incorrectly using the original `name` variable instead of the already-cleaned `cleanName` variable, causing the legacy prefix removal to fail.

9b0f0dcc9a99e807cdb55f9f8b6326896713c87c

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +2 -2Showing whitespace changes
public/scripts/bookmarks.js+2 -2
@@ -88,7 +88,7 @@ async function getBookmarkName({ isReplace = false, forceName = null } = {}) {
88 // Strip off existing suffixes, then build new name88 // Strip off existing suffixes, then build new name
89 let cleanName = name.replace(new RegExp(` - ${bookmarkNameToken}\\d+$`), '');89 let cleanName = name.replace(new RegExp(` - ${bookmarkNameToken}\\d+$`), '');
90 // Strip off legacy old name prefix too90 // Strip off legacy old name prefix too
91 cleanName = name.replace(new RegExp(`^${bookmarkNameToken}\\d+ - `), '');91 cleanName = cleanName.replace(new RegExp(`^${bookmarkNameToken}\\d+ - `), '');
92 return `${cleanName} - ${bookmarkNameToken}${i}`;92 return `${cleanName} - ${bookmarkNameToken}${i}`;
93 }93 }
94 const existingChats = await getExistingChatNames();94 const existingChats = await getExistingChatNames();
@@ -183,7 +183,7 @@ export async function createBranch(mesId) {
183 // Strip off existing suffixes, then build new name183 // Strip off existing suffixes, then build new name
184 let cleanName = name.replace(/ - Branch #\d+$/, '');184 let cleanName = name.replace(/ - Branch #\d+$/, '');
185 // Strip off legacy old name prefix too185 // Strip off legacy old name prefix too
186 cleanName = name.replace(/^Branch #\d+ - /, '');186 cleanName = cleanName.replace(/^Branch #\d+ - /, '');
187 return `${cleanName} - Branch #${i}`;187 return `${cleanName} - Branch #${i}`;
188 }188 }
189 const existingChats = await getExistingChatNames();189 const existingChats = await getExistingChatNames();