Allow absolute urls for link preview thumbnails

This commit is contained in:
Christoph Hagen 2022-09-04 17:45:44 +02:00
parent 9408b91741
commit 9a40da63d3

View File

@ -106,8 +106,12 @@ final class ValidationLog {
func linkPreviewThumbnail(customFile: String?, for language: String, in folder: URL, source: String) -> String? {
if let customFile = customFile {
#warning("Allow absolute urls for link preview thumbnails")
let customFileUrl = folder.appendingPathComponent(customFile)
let customFileUrl: URL
if customFile.starts(with: "/") {
customFileUrl = URL(fileURLWithPath: customFile)
} else {
customFileUrl = folder.appendingPathComponent(customFile)
}
guard customFileUrl.exists else {
missing(customFile, requiredBy: "property 'linkPreviewImage' in metadata of \(source)")
return nil