Allow absolute urls for link preview thumbnails
This commit is contained in:
parent
9408b91741
commit
9a40da63d3
@ -106,8 +106,12 @@ final class ValidationLog {
|
|||||||
|
|
||||||
func linkPreviewThumbnail(customFile: String?, for language: String, in folder: URL, source: String) -> String? {
|
func linkPreviewThumbnail(customFile: String?, for language: String, in folder: URL, source: String) -> String? {
|
||||||
if let customFile = customFile {
|
if let customFile = customFile {
|
||||||
#warning("Allow absolute urls for link preview thumbnails")
|
let customFileUrl: URL
|
||||||
let customFileUrl = folder.appendingPathComponent(customFile)
|
if customFile.starts(with: "/") {
|
||||||
|
customFileUrl = URL(fileURLWithPath: customFile)
|
||||||
|
} else {
|
||||||
|
customFileUrl = folder.appendingPathComponent(customFile)
|
||||||
|
}
|
||||||
guard customFileUrl.exists else {
|
guard customFileUrl.exists else {
|
||||||
missing(customFile, requiredBy: "property 'linkPreviewImage' in metadata of \(source)")
|
missing(customFile, requiredBy: "property 'linkPreviewImage' in metadata of \(source)")
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user