Skip to content

sign, sign_async and prefix interaction #682

@f-combes

Description

@f-combes

The functions sign and sign_async do not apply the prefix. So for instance this code:

import obstore
from obstore.store import GcsStore

store = GcsStore(bucket=..., prefix="some/prefix")

obs.put(store, "filename.txt", b"Contents")
obs.sign(store, "GET", "filename.txt", expires_in=timedelta(seconds=3600))

contains a subtle bug that seems impossible to notice at first glance. This doesn't seem documented:

paths (str | Sequence[str]) – The path(s) within ObjectStore to retrieve.

This is the same wording a, e.g. the put:

path (str) – The path within ObjectStore for where to save the file.

If this is intended, sign and sign_async documentation should mention this peculiarity? Otherwise, a (maybe? breaking) change in the function signature makes the code above not pass typechecking and fail at runtime with adding a mandatory kwarg use_prefix=True|False, or non-breaking with a "False" default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions