parent
9546def0fb
commit
dca62a85df
1 changed files with 23 additions and 16 deletions
|
|
@ -1,6 +1,5 @@
|
|||
// Copyright (c) 2022-2024 Sophie Herold
|
||||
// Copyright (c) 2022 Christopher Davis
|
||||
// Copyright (c) 2023 Gage Berz
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -177,17 +176,22 @@ impl LpFileModel {
|
|||
.await
|
||||
.context(gettext("Could not list other files in directory."))?;
|
||||
|
||||
for info in enumerator {
|
||||
loop {
|
||||
let info = enumerator.next_files_future(1, glib::Priority::LOW).await;
|
||||
match info {
|
||||
Err(err) => {
|
||||
log::warn!("Unreadable entry in directory: {err}");
|
||||
break;
|
||||
}
|
||||
Ok(info) => {
|
||||
// GVfs smb does not provide a CONTENT_TYPE if the content type is ambiguous.
|
||||
// This happens for png/apng. Since we only need to know if something is
|
||||
// probably an image, we can use the FAST_CONTENT_TYPE in these cases.
|
||||
let content_type =
|
||||
if info.has_attribute(gio::FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE) {
|
||||
if let Some(info) = info.first() {
|
||||
// GVfs smb does not provide a CONTENT_TYPE if the content type is
|
||||
// ambiguous. This happens for png/apng. Since we
|
||||
// only need to know if something is probably an
|
||||
// image, we can use the FAST_CONTENT_TYPE in these cases.
|
||||
let content_type = if info
|
||||
.has_attribute(gio::FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE)
|
||||
{
|
||||
info.content_type()
|
||||
} else {
|
||||
info.attribute_string(gio::FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE)
|
||||
|
|
@ -204,6 +208,9 @@ impl LpFileModel {
|
|||
new_files.insert(file.uri(), Entry::new(file).await);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue