Fix bookmark import issue with missing folder names #598
+16
−5
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.
🐛 Fix importing bookmarks from HTML with unnamed folders
Description
This pull request addresses an issue where importing bookmarks from an HTML file fails when a bookmark folder has no name. The current implementation fails the creation of collections for unnamed folders, leading to an infinite loader and no, or missing bookmarks.
Example
Here's an example of an HTML snippet that demonstrates the issue:
In this example, the bookmark folder with the name "Photos" is nested inside an unnamed folder. The current implementation fails to import all bookmarks and creates and infinite loader and wont import any bookmarks up to this point in the html.
Solution
The proposed solution is to handle the case when a bookmark folder has no name by assigning a default name, such as "Untitled Collection". This ensures that the collection is still created and all bookmarks will be imported correctly.
The changes are made in the
processBookmarks
function in theimportFromHTMLFile.ts
file. Here's the relevant code snippet:When the
collectionNameContent
is falsy (i.e., the folder has no name), a collection with the name "Untitled Collection" is created instead of failing the collection creation altogether.Benefits