Hide language buttons again if page is empty

This commit is contained in:
Christoph Hagen 2022-08-31 08:46:23 +02:00
parent 268ab205b5
commit 1537aaab01
2 changed files with 6 additions and 1 deletions

View File

@ -473,7 +473,7 @@ extension Element {
*/
private func existingContentUrl(for language: String) -> URL? {
let url = contentUrl(for: language)
guard url.exists else {
guard url.exists, let size = url.size, size > 0 else {
return nil
}
return url

View File

@ -35,4 +35,9 @@ extension URL {
try url.ensureParentFolderExistence()
try FileManager.default.copyItem(at: self, to: url)
}
var size: Int? {
let attributes = try? FileManager.default.attributesOfItem(atPath: path)
return (attributes?[.size] as? NSNumber)?.intValue
}
}