Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug][plugin-http] Can't fetch containing dots URLs using plugin-http #2106

Open
lucanisi opened this issue Nov 26, 2024 · 2 comments
Open
Labels
bug Something isn't working plugin: http

Comments

@lucanisi
Copy link

Hi there!

I encountered an issue with @tauri-apps/plugin-http when trying to fetch a URL that contains dots in the path. For example, attempting a fetch on the URL http://localhost:8080/abc.test/test.txt results in the following error:

SyntaxError: The string did not match the expected pattern.

Steps to Reproduce:

  1. Set up a simple server (e.g., at http://localhost:8080).
  2. Attempt to fetch a resource with a URL containing dots in the path, like http://localhost:8080/abc.test/test.txt.
fetch("http://localhost:8080/abc.test/test.txt");
  1. Observe that the fetch fails with the mentioned error.

Additional Observations:

  • If I modify the URL to replace the dot with another character, for example, abc-test, the fetch works correctly.
  • This behavior seems specific to URLs containing dots in the url path
  • The JS log is not very detailed; it simply stops at SyntaxError: The string did not match the expected pattern. without a detailed stack trace. The last point of the stack stops right at the fetch function with no further details.

Attempts done

  • Tried using encodeURI and encodeURIComponent of the URL, but it actually made the situation worse.

Tauri Info:

$ tauri info

[✔] Environment
    - OS: Mac OS 15.1.1 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 21.5.0
    - pnpm: 9.6.0
    - yarn: 1.22.22
    - npm: 10.2.4

[-] Packages
    - tauri :crab:: 2.1.1
    - tauri-build :crab:: 2.0.3
    - wry :crab:: 0.47.2
    - tao :crab:: 0.30.8
    - @tauri-apps/api : 2.1.1
    - @tauri-apps/cli : 2.1.0

[-] Plugins
    - tauri-plugin-deep-link :crab:: 2.0.1
    - @tauri-apps/plugin-deep-link : 2.0.0
    - tauri-plugin-fs :crab:: 2.0.3
    - @tauri-apps/plugin-fs : not installed!
    - tauri-plugin-http :crab:: 2.0.3
    - @tauri-apps/plugin-http : 2.0.1
    - tauri-plugin-shell :crab:: 2.0.2
    - @tauri-apps/plugin-shell : 2.0.1
    - tauri-plugin-single-instance :crab:: 2.0.1
    - @tauri-apps/plugin-single-instance : not installed!

[-] App
    - build-type: bundle
    - CSP: default-src 'self'; connect-src ipc: http://ipc.localhost
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite

Is this a known issue with the @tauri-apps/plugin-http package? Are there any workarounds or fixes for this behavior?

Thank you for your help!

@FabianLars FabianLars added bug Something isn't working plugin: http labels Nov 26, 2024
@FabianLars
Copy link
Member

Sorry for asking you to open an issue. Looks like this is likely not related to dots in the url. I will close this but will re-open if needed.

For more context: https://discord.com/channels/616186924390023171/1311030682931429417

@FabianLars FabianLars closed this as not planned Won't fix, can't repro, duplicate, stale Nov 28, 2024
@FabianLars FabianLars reopened this Dec 2, 2024
@amrbashir
Copy link
Member

does this issue still exist? can you provide a minimal repro?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plugin: http
Projects
None yet
Development

No branches or pull requests

3 participants