Merge lp:~michael-sheldon/thumbnailer/fix-1499341 into lp:thumbnailer

Proposed by Michael Sheldon
Status: Superseded
Proposed branch: lp:~michael-sheldon/thumbnailer/fix-1499341
Merge into: lp:thumbnailer
Diff against target: 33 lines (+23/-0)
1 file modified
src/thumbnailer.cpp (+23/-0)
To merge this branch: bzr merge lp:~michael-sheldon/thumbnailer/fix-1499341
Reviewer Review Type Date Requested Status
Michi Henning (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+272373@code.launchpad.net

This proposal has been superseded by a proposal from 2015-09-25.

Commit message

Fall back to full content type detector if the fast detector fails to return anything useful (e.g. because a file doesn't have an extension)

Description of the change

Fall back to full content type detector if the fast detector fails to return anything useful (e.g. because a file doesn't have an extension)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michi Henning (michihenning) wrote :

Thank you for the fix, much appreciated!

review: Approve
Revision history for this message
Michi Henning (michihenning) wrote :

Oops, I just realized: this is targeted at trunk, but should be targeted at devel instead. Could you re-target please?

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/thumbnailer.cpp'
--- src/thumbnailer.cpp 2015-09-15 09:37:17 +0000
+++ src/thumbnailer.cpp 2015-09-25 11:31:37 +0000
@@ -565,6 +565,29 @@
565 return ImageData(FetchStatus::error, Location::local); // LCOV_EXCL_LINE565 return ImageData(FetchStatus::error, Location::local); // LCOV_EXCL_LINE
566 }566 }
567567
568 if (content_type == "application/octet-stream") {
569 // The FAST_CONTENT_TYPE detector will return 'application/octet-stream'
570 // for all files without an extension (as it only uses the extension to
571 // determine file type), in these cases we fall back to the full content
572 // type detector.
573 gobj_ptr<GFileInfo> full_info(g_file_query_info(file.get(), G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
574 G_FILE_QUERY_INFO_NONE,
575 /* cancellable */ NULL,
576 /* error */ NULL));
577
578 if (!full_info)
579 {
580 return ImageData(FetchStatus::error, Location::local); // LCOV_EXCL_LINE
581 }
582
583 content_type = g_file_info_get_attribute_string(full_info.get(), G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
584 if (content_type.empty())
585 {
586 return ImageData(FetchStatus::error, Location::local); // LCOV_EXCL_LINE
587 }
588
589 }
590
568 // Call the appropriate image extractor and return the image data as JPEG (not scaled).591 // Call the appropriate image extractor and return the image data as JPEG (not scaled).
569 // We indicate that full-size images are to be cached only for audio and video files,592 // We indicate that full-size images are to be cached only for audio and video files,
570 // for which extraction is expensive. For local images, we don't cache full size.593 // for which extraction is expensive. For local images, we don't cache full size.

Subscribers

People subscribed via source and target branches

to all changes: