Bug in duplicate checking, when adding url_seed and in the whole library
master255 opened this issue · comments
@arvidn If you add url_seed within a single application (library) run, the check works correctly, but if you restart the application, the check fails and duplicates are added. I've seen these checks in various places in the library. So this needs to be fixed.
Here you need to compare the strings, not the objects.
Line 8987 in d28ee4e
I found the problem. If you add url_seed without a slash at the end: "http://qweqwe.com/qwe", then the library when saving and restoring resume data adds a slash at the end: "http://qweqwe.com/qwe/" and restores such a link.
So adding "http://qweqwe.com/qwe" again passes the check and is added. Since all links have a slash at the end.
So each time a new duplicate link is added.
To prevent this from happening, perhaps you should check and add a slash at the end at the beginning. Or write programs using this library so that the slash is always at the end. So there is a bug, but you may not fix it.