Skip to content

Commit e510b04

Browse files
committed
clean up
1 parent 7fbd029 commit e510b04

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

packages/storage/src/Storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type FileMetadata = z.infer<typeof FileMetadata>;
1616
* Options accepted during the creation of a signed URL.
1717
*/
1818
export type SignedURLOptions = {
19-
expiresIn?: string | number;
19+
expiresIn?: number;
2020
contentType?: string;
2121
contentDisposition?: string;
2222
} & Record<string, any>;

packages/storage/src/drivers/fs/driver.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ import type { StorageFile } from "../../StorageFile.js";
1414

1515
type FSDriverOptions = {
1616
location?: string;
17-
generateSignedURL?(
18-
key: string,
19-
filePath: string,
20-
options: SignedURLOptions,
21-
): Promise<string>;
17+
generateSignedURL?(key: string, options: SignedURLOptions): Promise<string>;
2218
};
2319

2420
export class FSDriver implements StorageDriver {
@@ -88,7 +84,7 @@ export class FSDriver implements StorageDriver {
8884
throw new Error("generateSignedURL is not defined");
8985

9086
const location = path.join(this._location, key);
91-
return this.options.generateSignedURL(location, location, opts);
87+
return this.options.generateSignedURL(location, opts);
9288
}
9389

9490
async getMetaData(key: string): Promise<ObjectMetadata> {

packages/storage/src/drivers/gcs/driver.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ export class GCSStorageDriver implements StorageDriver {
8585

8686
async getSignedUrl(path: string, opts: SignedURLOptions): Promise<string> {
8787
const expires = new Date();
88-
const m =
89-
typeof opts.expiresIn === "number"
90-
? opts.expiresIn
91-
: ms(opts.expiresIn ?? "30m");
88+
const m = opts.expiresIn ?? ms("30m");
9289
expires.setSeconds(new Date().getMilliseconds() + m);
9390
const [url] = await this.bucket.file(path).getSignedUrl({
9491
action: opts.action,

0 commit comments

Comments
 (0)