Skip to content

Item(id) panics in local implementation if the id is not a correct path #262

@acabarbaye

Description

@acabarbaye

in https://github.com/graymeta/stow/blob/973a61f346d598a566affb53c4698764a67df164/local/container.go#L132

info, err := os.Stat(path)
	if os.IsNotExist(err) {
		return nil, stow.ErrNotFound
	}
	if info.IsDir() {
		return nil, errors.New("unexpected directory")
	}

if the stat fails because the path is not valid and so if the error is differetn than not exist, info is nil and so the line info.IsDir panics with runtime error: invalid memory address or nil pointer dereference

The correct behaviour should be to return an error if stat fails

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions