-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
zimdump list --ns=<N> doesn't work as a filter #171
Comments
I believe I can confirm this problem I was already impacted myself. Is that easy to fix? |
@maneeshpm Would you like to look at this bug? This is a pretty anooying one for users. |
Sure @kelson42, I'll start working on this one. |
@kelson42 Even though we are providing the |
@veloman-yunkan Do you believe his is the proper way of doing? |
@maneeshpm I guess you missed the /** Find a range of entry starting with path.
*
* The path is the "long path". (Ie, with the namespace)
*
* @param path The path prefix to search for.
* @return A range starting from the first entry starting with path
* and ending past the last entry.
* If no entry starts with `path`, begin == end.
*/
EntryRange<EntryOrder::pathOrder> findByPath(std::string path) const; |
Thanks for pointing it out @veloman-yunkan, I tried it, std::tuple<char, std::string> zim::parseLongPath(const std::string& longPath)
{
/* Index of the namespace char; discard '/' from absolute paths */
const unsigned int i = (longPath[0] == '/') ? 1 : 0;
if (i + 2 >= longPath.size() || longPath[i] == '/' || longPath[i+1] != '/')
throw std::runtime_error("Cannot parse path"); But modifying this function such that it returns the namespace along with an empty string as path when such a url is passed std::tuple<char, std::string> zim::parseLongPath(const std::string& longPath)
{
/* Index of the namespace char; discard '/' from absolute paths */
const unsigned int i = (longPath[0] == '/') ? 1 : 0;
if (i + 2 >= longPath.size() && longPath[i] != '/')
return std::make_tuple(longPath[i], "");
if (i + 2 >= longPath.size() || longPath[i] == '/' || longPath[i+1] != '/')
throw std::runtime_error("Cannot parse path");
After this modification:
@kelson42 I believe this is the expected behavior. |
@maneeshpm Yes, seems to be the proper behaviour but you should not have to modify the libzim. I let you sort ot these details and the review with @veloman-yunkan |
@maneeshpm Please, prepare a PR (even in draft), it is not a good idea to work on code (review) base on the ticket. |
Ohk @kelson42, thanks for the information. |
- Throws runtime error in call to findByPath()->findx()->parseLongPath().
- changed function to use a brute force approach - provides a work around to the parseLongPath
…s-a-filter Fixes #171 zimdump list --ns=<N> doesn't work as a filter
Program: zimdump (for zim-tools)
Version: current master (243e869)
Actual result:
The output of those commands below are equal:
Expected result:
I expect --ns= to work as a filter, listing entries only from the specified namespace, skipping the others.
The text was updated successfully, but these errors were encountered: