Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294413

Unnecessary restrictions on logo format: Can't upload replacement SVG logo

$
0
0

Problem

Page: admin/appearance/settings
Action: I want to set an svg image file as the logo

Situation 1:
- Place the file logo.svg myself on the root of the web site.
- Uncheck "Use the default logo supplied by the theme".
- Fill in logo.svg in "Path to custom logo".
- Click "Save configuration".

result: OK, logo changed and displays as expected. See Figure 1 which demonstrates this behavior.

Situation 2:
- Uncheck "Use the default logo supplied by the theme".
- Browse to the logo.svg on my local computer and select it in "Upload logo image".
- Click "Save configuration".

result: file refused with error messages:

    The specified file logo.svg could not be uploaded.
        - Image type not supported. Allowed types: png jpeg gif
        - Only files with the following extensions are allowed: jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp.
    The logo could not be uploaded.

What is wrong:
- The 1st error message comes from the active toolkit in the Image system, but as the logo will not be manipulated by the toolkit, it should stay out of this setting.
- The 2nd error is even stranger as the logo file now suddenly seems to be treated as a regular file upload.

See Figure 2 for error messages when uploading an SVG.

Proposed resolution

  • There should only be a check if the logo is a regular/known image format.
  • Both ways of defining the logo should react the same.

See Figure 3 for expected behavior when uploading an SVG.

User interface changes

Update error messages when uploading an invalid file.

Current (when uploading a .txt file):

The specified file logo.txt could not be uploaded.

    The image file is invalid or the image type is not allowed. Allowed types: png, jpeg, jpg, jpe, gif, webp

Expected:

The specified file logo.txt could not be uploaded.

    Only files with the following extensions are allowed: png gif jpg jpeg apng svg.

See Figure 4 for expected behavior when uploading an invalid file.

Remaining tasks

Finalize list of allowed extensions.

API changes

None.

Contributor tasks needed
TaskNovice task?Contributor instructionsComplete?
Create a patchInstructions
Review patch to ensure that it fixes the issue, stays within scope, is properly documented, and follows coding standardsInstructions

Screenshots and mockups

Figure 1. Defining a custom logo path after uploading a file directly to the filesystem.

Figure 2. Current core behavior when attempting to upload an SVG.

Figure 3. Expected core behavior when attempting to upload an SVG.

Figure 4. Expected core behavior when attempting to upload an invalid file type.


Viewing all articles
Browse latest Browse all 294413

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>