archethic-foundation / archethic-node

Official Archethic Blockchain node, written in Elixir
GNU Affero General Public License v3.0
75 stars 22 forks source link

Fix aeweb case sensitivity for asset names #1580

Closed wassimans closed 1 month ago

wassimans commented 1 month ago

Description

This pull request addresses the issue of case sensitivity in asset names, which was causing user inconvenience when trying to reference assets with different letter cases. For instance, if an asset was named “Logo.png” and referenced in HTML as “logo.png,” AEWebsite would fail to display the image correctly.

The solution normalizes the URL paths by downcasing them before processing, ensuring that assets can be referenced in a case-insensitive manner.

Fixes #1049

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

To verify the changes, I created a simple test website with an index.html file, style.css, and an image file (Logo.png) in the assets/images folder. I added two image references in the HTML file, one using logo.png and another using LoGo.png. The fix was verified by confirming that both references successfully displayed the image.

I also added a unit test that verifies the url_path is downcased before further processing.

Steps to reproduce:

1.  Create a website with an asset named “Logo.png”.
2.  Reference the image in HTML using “logo.png” or “LoGo.png”.
3.  Run the project to confirm that both references display the image correctly.

•   Test A: Verified website test with multiple image case references.
•   Test B: Unit test added to ensure URL paths are downcased before processing.

Checklist:

Neylix commented 1 month ago

Nice job ! First PR :rocket:

wassimans commented 1 month ago

Thanks @Neylix! Wasn't possible without your help.