8000 Why validate path doesn't start with a slash? · Issue #501 · spf13/afero · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Why validate path doesn't start with a slash? #501
Open
@heaths

Description

@heaths

afero/iofs.go

Line 39 in f42493f

if !fs.ValidPath(name) {

I'm trying to test some code where I deal with absolute paths - mainly because of how often os.Getwd() gets called directly or indirectly. Using testing/fstest.MapFS didn't work for me because of the call to fs.ValidPath which validates paths don't start with "/". Given how insecure it already is I've never understood why (maybe originally they thought it secure?), but why does afero repeat that for IOFS?

I'm trying to reduce dependencies and would rather not take a dependency on afero for more than testing. While that won't reduce fetch times, it should reduce compile times.

Could we have an IOFS that does not validate paths? Maybe a new constructor that lets us turn off the validation but keeps everything in place otherwise? I'd be happy to submit a PR if you're open to such a change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0