Skip to content
This repository was archived by the owner on Jan 29, 2021. It is now read-only.
This repository was archived by the owner on Jan 29, 2021. It is now read-only.

Certain remote URLs trigger \Transit\File::type() to return wrong $type #19

Description

@mfn

Sidenote: I'm using transit via deprecaed CakePHP Uploader Plugin on Linux.

Imagine an URL like: http://server/image.php?id=12312

\Transit\File::type() will perform the following steps:

  • $type is first determined via file -b --mime ... and gets detected as image
  • next, $ext = $file->ext() will return text/x-php
  • they do not match in this check later: $type !== $extType
  • $type will be forced to be the file extension type, basically ignoring the actual content type

This behaviour is problematic as serving an image via such an URLs is perfectly legit.

One approach could be to only use the extension if either the file -b --mime... and the finfo_file() logic do not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions