• Daniel Cheng's avatar
    Use a prefix check to determine if a well-known MIME type is an image. · c6765c28
    Daniel Cheng authored
    The original code used a different way to check that the extension is an
    image extension (and not something else, like .exe), but this depended
    on being able to directly access the blink::Image class. When the name
    calculation was moved into the browser, blink::IsSupportedImageType was
    used instead to ensure that a user doesn't drag out an image and get
    something surprising like an executable instead.
    
    However, it turns out that blink::IsSupportedImageType doesn't consider
    SVG an image type--since it's actually an XML file. To get around this,
    just simply check that the MIME type begins with image/. This is safe
    enough, since the filename calculation only takes well-known MIME
    types into consideration.
    
    Bug: 767775
    Change-Id: I5c71d8ae2daa9a413beab9c3c1cb393760383323
    Reviewed-on: https://chromium-review.googlesource.com/721615
    Commit-Queue: Daniel Cheng <dcheng@chromium.org>
    Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#509317}
    c6765c28
drop_data.cc 2.12 KB