Skip to content

389 file non supportato#391

Merged
valeriocomo merged 3 commits intodevelopfrom
389-file-non-supportato
Mar 19, 2025
Merged

389 file non supportato#391
valeriocomo merged 3 commits intodevelopfrom
389-file-non-supportato

Conversation

@AlexPalaz
Copy link
Copy Markdown
Collaborator

@AlexPalaz AlexPalaz commented Mar 19, 2025

Fix: YAML / YML File Uploading on Windows

Tested on:

  • Operating System: Windows 11
  • Browsers: Chrome, Firefox, Edge

Problem:

On Windows 11, when selecting .yml or .yaml files via the file dialog in a browser, the file.type is often empty. This caused issues with proper YAML file recognition, especially when the MIME type isn't automatically detected by the browser.

Solution:

  • Handling empty MIME types: We added a check for cases where file.type is empty and the user is on Windows. In these cases, we fall back to checking the file extension (either .yml or .yaml) to determine if the file is a YAML file.
  • Updated isYamlFile function: The logic now correctly handles cases where file.type is empty, ensuring proper YAML file recognition on Windows.
  • Improved tests: We updated and expanded the tests to account for different scenarios, including cases where file.type is empty, ensuring correct handling of .yml and .yaml files.

Changes:

  • isYamlFile function: Improved to check the file extension when file.type is empty and the user is on Windows.
  • Test updates:
    • Tests now cover scenarios where file.type is empty on Windows, ensuring .yml and .yaml files are properly recognized.
    • Simulated navigator.userAgent for more accurate testing in Windows environments using jest.spyOn().
  • Devcontainer Update: Added a command to the devcontainer build to install localtunnel globally

@AlexPalaz AlexPalaz requested a review from valeriocomo March 19, 2025 14:23
@AlexPalaz AlexPalaz linked an issue Mar 19, 2025 that may be closed by this pull request
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
publiccode-editor ✅ Ready (Inspect) Visit Preview Mar 19, 2025 2:51pm
publiccode-editor-legacy ✅ Ready (Inspect) Visit Preview Mar 19, 2025 2:51pm

@AlexPalaz AlexPalaz changed the base branch from main to develop March 19, 2025 14:38
Copy link
Copy Markdown
Member

@valeriocomo valeriocomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vercel vercel Bot temporarily deployed to Preview – publiccode-editor-legacy March 19, 2025 14:51 Inactive
@valeriocomo valeriocomo added the bug Something isn't working label Mar 19, 2025
@valeriocomo valeriocomo merged commit 4360e14 into develop Mar 19, 2025
@valeriocomo valeriocomo deleted the 389-file-non-supportato branch March 19, 2025 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File non supportato

2 participants