Skip to content

Commit

Permalink
Do not show externally created hidden files with no file info (#2200)
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan Kornheisl <ryan@skarva.tech>
  • Loading branch information
Jeremy Wootten and zeebok authored May 22, 2023
1 parent 9e94408 commit 61fb31f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 8 additions & 4 deletions libcore/Directory.vala
Original file line number Diff line number Diff line change
Expand Up @@ -910,12 +910,16 @@ public class Files.Directory : Object {
}

private void add_and_refresh (Files.File gof, bool is_internal) {
if (gof.info == null) {
critical ("FILE INFO null");
// Check whether we have FileInfo
if (!gof.ensure_query_info ()) {
critical ("FILE INFO unavailable");
// Fallback to determining hidden status from file name
gof.is_hidden = gof.basename.has_prefix (".") || gof.basename.has_prefix ("~");
} else {
// Update properties from FileInfo
gof.update ();
}

gof.update ();

if ((!gof.is_hidden || Preferences.get_default ().show_hidden_files)) {
file_added (gof, is_internal);
}
Expand Down
4 changes: 3 additions & 1 deletion libcore/File.vala
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,9 @@ public class Files.File : GLib.Object {
}

public void update () {
GLib.return_if_fail (info != null);
if (info == null) {
return;
}

/* free previously allocated */
clear_info ();
Expand Down

0 comments on commit 61fb31f

Please sign in to comment.