Skip to content
Discussion options

You must be logged in to vote

I will try to see if the whole logic can be simplified a bit before opening a PR for it 👀

🤯 I just found a much simpler way to extract the sub path, by using bee.filesystem's fs.relative(path, base)

  • this will try to convert path into a relative path format of base (if possible)
  • and we can then check if this relative path starts with ..
    • if it starts with .. => this is NOT a sub path under the base path
    • otherwise => this IS a valid sub path under the base path
  • this technique has been used here (in PR #3070)
    function export.getLocalPath(uri)
    local file_canonical = fs.canonical(furi.decode(uri)):string

Replies: 2 comments 16 replies

Comment options

You must be logged in to vote
9 replies
@tomlau10
Comment options

@sewbacca
Comment options

@tomlau10
Comment options

@sewbacca
Comment options

@tomlau10
Comment options

Comment options

You must be logged in to vote
7 replies
@tomlau10
Comment options

@sewbacca
Comment options

@tomlau10
Comment options

@tomlau10
Comment options

Answer selected by sewbacca
@sewbacca
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants