Skip to content

Commit

Permalink
clapper-app: Fix opened file content type detection
Browse files Browse the repository at this point in the history
Fixes issues with detecting whether file has one of supported subtitles mime types
  • Loading branch information
Rafostar committed Jun 14, 2024
1 parent 2eaf503 commit df371c6
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/bin/clapper-app/clapper-app-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,21 @@ clapper_app_utils_is_subtitles_file (GFile *file)
G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
G_FILE_QUERY_INFO_NONE,
NULL, NULL))) {
is_subs = g_strv_contains (
const gchar *content_type = NULL;

if (g_file_info_has_attribute (info,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE)) {
content_type = g_file_info_get_content_type (info);
} else if (g_file_info_has_attribute (info,
G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE)) {
content_type = g_file_info_get_attribute_string (info,
G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE);
}

is_subs = (content_type && g_strv_contains (
clapper_app_utils_get_subtitles_mime_types (),
g_file_info_get_content_type (info));
content_type));

g_object_unref (info);
}

Expand Down

0 comments on commit df371c6

Please sign in to comment.