Repository: godotengine/godot
File: editor/docks/filesystem_dock.cpp (C++)

Code before:

Ref<CanvasTexture> FileSystemDock::_apply_thumbnail_filter(const Ref<Texture2D> p_thumbnail, const String &p_file_path) const {
	Ref<CanvasTexture> thumbnail_wrapped;
	thumbnail_wrapped.instantiate();
	thumbnail_wrapped->set_diffuse_texture(p_thumbnail);

	if (!p_file_path.is_empty()) {
		int index;
		EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->find_file(p_file_path, &index);

		if (dir) {
			if (dir->get_file_import_is_valid(index)) {
				const String &file_type = dir->get_file_type(index);

				if (file_type == SNAME("CompressedTexture2D") || file_type == SNAME("Image")) {
					const String extension = p_file_path.get_extension();

					if (extension != "svg" && extension != "svgz") {
						thumbnail_wrapped->set_texture_filter(CanvasItem::TextureFilter::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS);
					}
				}
			}
		}
	}

	return thumbnail_wrapped;
}

void FileSystemDock::_toggle_file_display() {
	_set_file_display(file_list_display_mode != FILE_LIST_DISPLAY_LIST);
	emit_signal(SNAME("display_mode_changed"));
}

void FileSystemDock::_set_file_display(bool p_active) {
	if (p_active) {
		file_list_display_mode = FILE_LIST_DISPLAY_LIST;
		button_file_list_display_mode->set_button_icon(get_editor_theme_icon(SNAME("FileThumbnail")));
		button_file_list_display_mode->set_tooltip_text(TTRC("View items as a grid of thumbnails."));
	} else {
		file_list_display_mode = FILE_LIST_DISPLAY_THUMBNAILS;
		button_file_list_display_mode->set_button_icon(get_editor_theme_icon(SNAME("FileList")));
		button_file_list_display_mode->set_tooltip_text(TTRC("View items as a list."));
	}

	_update_file_list(true);
}

bool FileSystemDock::_is_file_type_disabled_by_feature_profile(const StringName &p_class) {
	Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile();
	if (profile.is_null() || !ClassDB::class_exists(p_class)) {
		return false;

Review comment (suggestion):
And this would be
```suggestion
	return p_thumbnail;
```

Code after:

Ref<Texture2D> FileSystemDock::_apply_thumbnail_filter(const Ref<Texture2D> &p_thumbnail, const String &p_file_path) const {
	if (!p_file_path.is_empty()) {
		int index;
		EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->find_file(p_file_path, &index);

		if (dir) {
			if (dir->get_file_import_is_valid(index)) {
				const StringName &file_type = dir->get_file_type(index);

				if (file_type == SNAME("CompressedTexture2D") || file_type == SNAME("Image")) {
					const String extension = p_file_path.get_extension();

					if (extension != "svg" && extension != "svgz") {
						Ref<CanvasTexture> thumbnail_wrapped;
						thumbnail_wrapped.instantiate();
						thumbnail_wrapped->set_diffuse_texture(p_thumbnail);
						thumbnail_wrapped->set_texture_filter(CanvasItem::TextureFilter::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS);
						return thumbnail_wrapped;
					}
				}
			}
		}
	}

	return p_thumbnail;
}

void FileSystemDock::_toggle_file_display() {
	_set_file_display(file_list_display_mode != FILE_LIST_DISPLAY_LIST);
	emit_signal(SNAME("display_mode_changed"));
}

void FileSystemDock::_set_file_display(bool p_active) {
	if (p_active) {
		file_list_display_mode = FILE_LIST_DISPLAY_LIST;
		button_file_list_display_mode->set_button_icon(get_editor_theme_icon(SNAME("FileThumbnail")));
		button_file_list_display_mode->set_tooltip_text(TTRC("View items as a grid of thumbnails."));
	} else {
		file_list_display_mode = FILE_LIST_DISPLAY_THUMBNAILS;
		button_file_list_display_mode->set_button_icon(get_editor_theme_icon(SNAME("FileList")));
		button_file_list_display_mode->set_tooltip_text(TTRC("View items as a list."));
	}

	_update_file_list(true);
}

bool FileSystemDock::_is_file_type_disabled_by_feature_profile(const StringName &p_class) {
	Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile();
	if (profile.is_null() || !ClassDB::class_exists(p_class)) {
		return false;