-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Public and private files on separate paths
- Loading branch information
Rajat Saxena
committed
May 8, 2024
1 parent
0923b66
commit 6fd2a98
Showing
3 changed files
with
53 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,31 @@ | ||
import { CLOUD_PREFIX } from "../../config/constants"; | ||
|
||
interface GenerateKeyProps { | ||
mediaId: string; | ||
type: "main" | "thumb"; | ||
extension?: string; | ||
} | ||
// interface GenerateKeyProps { | ||
// mediaId: string; | ||
// type: "main" | "thumb"; | ||
// extension?: string; | ||
// } | ||
|
||
// export default function generateKey({ | ||
// mediaId, | ||
// type, | ||
// extension, | ||
// }: GenerateKeyProps): string { | ||
// return `${CLOUD_PREFIX ? `${CLOUD_PREFIX}/` : ""}${mediaId}/${type}.${ | ||
// type === "thumb" ? "webp" : extension | ||
// }`; | ||
// } | ||
|
||
export default function generateKey({ | ||
mediaId, | ||
type, | ||
extension, | ||
}: GenerateKeyProps): string { | ||
return `${CLOUD_PREFIX ? `${CLOUD_PREFIX}/` : ""}${mediaId}/${type}.${ | ||
type === "thumb" ? "webp" : extension | ||
}`; | ||
access, | ||
filename, | ||
}: { | ||
mediaId: string; | ||
access: "private" | "public"; | ||
filename: string; | ||
}): string { | ||
return `${ | ||
CLOUD_PREFIX ? `${CLOUD_PREFIX}/` : "" | ||
}${access}/${mediaId}/${filename}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters