tweedegolf / storage-abstraction

Provides an abstraction layer for interacting with a storage; the storage can be local or in the cloud.
MIT License
106 stars 18 forks source link

AbstractAdapter validate bucketName option should be optional but isn't #59

Closed ueberBrot closed 7 months ago

ueberBrot commented 7 months ago

For the AdapterLocal the bucketName is defined as optional in the AdapterConfig (Link)

export interface AdapterConfig {
    bucketName?: string;
    [id: string]: any;
}

But it is actually required as it is shown in the AbstractAdapter file here.

abudaan commented 7 months ago

bucketName is not required upon instantiation but if you don't provide it in the config you must provide it as a param to addFile.

You can see it literally in the code:

if (typeof params.bucketName === "undefined") {  // if bucketName is not provided to addFile
      if (this._bucketName === null) {           // and it hasn't been set upon instantiation
        return {                                 // we return an error
          value: null,
          error: "no bucket selected",
        };