question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

_ls_from_cache: weird behavior regarding comparisons with trailing slash

See original GitHub issue

In this example, the path is stripped only for the contain check. When dircache contains the normalized version (a/b) but not a/b/ it will throw a KeyError though it probably shouldn’t since this is what that check appears to be stand for. Another case is right below that code that compares the normalized version with the obtained one from the cache, which might not be normalized. So I was wondering whether this is intentional or should we use .rstrip() in both of the cases (self.dircache[path.rstrip('/')], f["name"].rstrip("/") == path.rstrip("/")) https://github.com/intake/filesystem_spec/blob/6ee47aa6c10868c383be5cb13837f2a26a099f5d/fsspec/spec.py#L342-L343 https://github.com/intake/filesystem_spec/blob/6ee47aa6c10868c383be5cb13837f2a26a099f5d/fsspec/spec.py#L349

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
martindurantcommented, Apr 14, 2021

https://github.com/intake/filesystem_spec/issues/562 is the discussion where I hope we can come to an agreement. I imagined the outcome to be a set of tests hosted in this repo, but run against all three object stores.

0reactions
TomAugspurgercommented, Apr 14, 2021

Let’s come up with a set of rules that we can adhere to and test thoroughly, and document for users (who are confused by the different ways to access their data).

@martindurant is there a document for this (or issue for tracking writing this document)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

weird behavior regarding comparisons with trailing slash #554
In this example, the path is stripped only for the contain check. When dircache contains the normalized version (a/b) but not a/b/ it...
Read more >
Why adding trailing slash breaks caching? - Stack Overflow
Resources with / and no-/ are both seen as different resources but serve the same content. It's therefore seen as duplicate content.
Read more >
URL without trailing slash can't be accessed - Bugzilla@Mozilla
The URL should remain localhost/api when I specifically remove the trailing slash. Adding a blacklist to autofill (in this case 'localhost') could solve ......
Read more >
Damn trailing slash : r/rust - Reddit
So in many cases you still have to manually normalize the paths before comparing them, which means this weird behavior is completely superfluous ......
Read more >
Sitemap links do not have trailing / | WordPress.org
In our linked sitemap, the post URLs do not have a trailing slash. ... I cleared the Cloudflare cache for that URL but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found