Unverified Commit 3181c076 authored by Elliot Chen's avatar Elliot Chen Committed by GitHub

feat: add {uuid} in path template when using local storage or S3 (#2696)

Add {uuid} in path template when using local storage or S3

Add an addition tag `{uuid}` to the `replacePathTemplate`.

It is a workaround to leak the public links of a resource when using S3-based object storage. Currently, all resource blobs stored in S3 (R2, OSS) are set to be public. It is insecure as the resources for the private memos are also accessible on the Internet. Using an additional {uuid} might reduce this risk.

Meanwhile, it is also possible to avoid filename conflict
parent 673809e0
...@@ -354,6 +354,8 @@ func replacePathTemplate(path, filename string) string { ...@@ -354,6 +354,8 @@ func replacePathTemplate(path, filename string) string {
return fmt.Sprintf("%02d", t.Minute()) return fmt.Sprintf("%02d", t.Minute())
case "{second}": case "{second}":
return fmt.Sprintf("%02d", t.Second()) return fmt.Sprintf("%02d", t.Second())
case "{uuid}":
return util.GenUUID()
} }
return s return s
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment