mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
8 lines
285 B
TypeScript
8 lines
285 B
TypeScript
export const getResourceUrl = (resource: Resource, withOrigin = true) => {
|
|
if (resource.externalLink) {
|
|
return resource.externalLink;
|
|
}
|
|
|
|
return `${withOrigin ? window.location.origin : ""}/o/r/${resource.id}/${resource.publicId}/${encodeURIComponent(resource.filename)}`;
|
|
};
|