File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -263,7 +263,14 @@ export const list = query({
263263 return Promise .all (
264264 messages .map (async (message ) => ({
265265 ... message ,
266- imageUrl: await r2 .getUrl (message .imageKey ),
266+ imageUrl: await r2 .getUrl (
267+ message .imageKey ,
268+ // Options object is optional, can be omitted
269+ {
270+ // Custom expiration time in seconds, default is 900 (15 minutes)
271+ expiresIn: 60 * 60 * 24 , // 1 day
272+ }
273+ ),
267274 }))
268275 );
269276 },
Original file line number Diff line number Diff line change @@ -145,11 +145,11 @@ export class R2 {
145145 *
146146 * @param key - The R2 object key.
147147 * @param options - Optional config object.
148- * - `expiresIn` - The number of seconds until the URL expires (default: 3600 , max: 604800 for 7 days).
148+ * - `expiresIn` - The number of seconds until the URL expires (default: 900 , max: 604800 for 7 days).
149149 * @returns A promise that resolves to a signed URL for the object.
150150 */
151151 async getUrl ( key : string , options : { expiresIn ?: number } = { } ) {
152- const { expiresIn = 3600 } = options ;
152+ const { expiresIn = 900 } = options ;
153153 return await getSignedUrl (
154154 this . r2 ,
155155 new GetObjectCommand ( { Bucket : this . config . bucket , Key : key } ) ,
You can’t perform that action at this time.
0 commit comments