dnnsoftware / Dnn.Platform

DNN (formerly DotNetNuke) is the leading open source web content management platform (CMS) in the Microsoft ecosystem.
https://dnncommunity.org/
MIT License
1.02k stars 751 forks source link

Allow Webp format #5360

Open uzmannazari opened 1 year ago

uzmannazari commented 1 year ago

WebP is a modern image format and and DNN does not support it in its site settings.

Its not possible to upload webp image format on the Logo option at site settings.

WillStrohl commented 1 year ago

First, this could definitely work as a new feature, but you can already do this today if you want..

It's not possible out-of-the-box, but it is possible after a tiny bit of configuration. All you need to do is:

  1. Allow the file extension in the global allow list.
  2. Update the web.config to allow this kind of file to be properly served.

Example Snippet from an Existing web.config

<system.webServer>
  <staticContent>
    <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
    <remove fileExtension=".webp" />
    <mimeMap fileExtension=".webp" mimeType="image/webp" />
    <remove fileExtension=".svg" />
    <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
    <remove fileExtension=".woff" />
    <mimeMap fileExtension=".woff" mimeType="font/x-woff" />
    <remove fileExtension=".woff2" />
    <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
  </staticContent>
uzmannazari commented 1 year ago

hi @WillStrohl first, i wrote the format type on global allow list

image then i edited the web.config as you said

image

then recycle the app pool and clear the cache but the file format is not at supported format list of the upload logo windows

Untitled

WillStrohl commented 1 year ago

Oh, well the upload dialog is a completely separate thing. That might need to be updated differently, depending on where it is and what it does.

You'll need to update your original post here to be more fully detailed on where in the website you're going and what you're trying to update. The list of files that appears in the Windows dialog is not directly related to the allowable files at this point the use case. It comes into play after the Windows dialog allows you to choose one or more files.

So, please update your post's original description to include the exact steps to reproduce the issue you'd like to see resolved.

Thank you! :)

uzmannazari commented 1 year ago

I think I explained at the beginning that the problem is in the logo upload part of the site settings!

WillStrohl commented 1 year ago

I'm sorry you're upset, but if you want something fixed in any open source project, the path is pretty consistent across major projects. The template you deleted to write your original post would have the greatest chance of getting this looked at by anyone else. The exact Steps to Reproduce are always required, because the way you do something is not necessarily the way someone else might do it.

If you don't want to do that, this is fine. I'm just letting you know that you'll have a better chance of getting more help. It's up to you. You don't have to do anything you don't want to do. 🤷🏽‍♂️

stale[bot] commented 1 year ago

We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically. If new comments are are posted and/or a solution (pull request) is submitted for review that references this issue, the issue will not be closed. Closed issues can be reopened at any time in the future. Please remember those participating in this open source project are volunteers trying to help others and creating a better DNN Platform for all. Thank you for your continued involvement and contributions!

jeremy-farrance commented 3 months ago

Adding WEBP to DNN as a standard option still feels needed and necessary. Just to bring topic up to date, correct a few mistakes in the details above, and provide a video demonstrating the problem...

After a default DNN install:

  1. In web.config, add or ensure you have webp mime mapped (see Will's example above)

  2. Allow the "webp" file extension in Settings / Security for both Allowable File Extensions and Default End User Extension Whitelist: image

  3. In Site Settings, Site Behavior tab, MORE, change the Whitelist for end users to Custom, then add "webp" to the Allowed File Extensions image

Now, as you can see, even though uzmannazari didn't have enough information for us to reproduce the problem, here is a video demo that clearly shows that the PersonaBar's Site Settings panel is not using DNN's settings for the allowed image formats.

VIDEO

Wrong Format Error (appears for about 1 second) after selecting the WEBP file and clicking the Open button. Important: this video is AFTER the above 3 config/settings changes: https://accuraty-my.sharepoint.com/:v:/p/jfarrance/ERvPYc2TntRBmcsZr7NaNv4Bm6GkDeiTr6IP41t0_9yvYQ?e=ReKzSV

My guess was Dnn.React.Common's FileUpload component was the problem and had the allowed file extensions hard-coded:

https://github.com/dnnsoftware/Dnn.Platform/blob/develop/Dnn.AdminExperience/ClientSide/Dnn.React.Common/src/FileUpload/Browse/index.jsx

But I was wrong, as you can see, they ARE hard coded. But DO include "webp", see line 99-132.

So anyhow, accurate and tested details, a video that makes the problem easy to understand and reproduce. I hope this gets some attention in time for DNN v10.