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

FileUpload shouldn't post to url if none is provided #7180

Closed
1 of 4 tasks
ntjess opened this issue Feb 2, 2025 · 0 comments
Closed
1 of 4 tasks

FileUpload shouldn't post to url if none is provided #7180

ntjess opened this issue Feb 2, 2025 · 0 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@ntjess
Copy link

ntjess commented Feb 2, 2025

Describe the bug

The FileUpload component provides an optional url parameter that defaults to null if unspecified. However, it will always post to this url, so leaving it unpopulated causes errors to appear in the console:

<FileUpload :auto="true" />

Selecting a document produced the console error:

POST http://localhost:5173/null 404 (Not Found)

My expectation is that no url specified means no post should occur.

Potential PR

I think this is the only line to change?

xhr.open('POST', this.url, true);

It just needs to change to conditionally check for null, right?

Pull Request Link

No response

Reason for not contributing a PR

  • Lack of time
  • Unsure how to implement the fix/feature
  • Difficulty understanding the codebase
  • Other

Other Reason

No response

Reproducer

https://stackblitz.com/edit/primevue-4-vite-issue-template-3jqjjbaa?file=src%2FApp.vue

Environment

Macos / node 22.11.0

Vue version

3.4.27

PrimeVue version

4.1.1

Node version

22.11.0

Browser(s)

No response

Steps to reproduce the behavior

  1. Open dev console
  2. Click "upload"
  3. Select a file
  4. Observe the error logged in the console

Expected behavior

No POST request made, since no url was specified

@ntjess ntjess added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 2, 2025
@tugcekucukoglu tugcekucukoglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Feb 5, 2025
@tugcekucukoglu tugcekucukoglu added this to the 4.3.0 milestone Feb 5, 2025
@tugcekucukoglu tugcekucukoglu self-assigned this Feb 5, 2025
@github-project-automation github-project-automation bot moved this to Review in PrimeVue Feb 5, 2025
@github-project-automation github-project-automation bot moved this from Review to Done in PrimeVue Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
Status: Done
Development

No branches or pull requests

2 participants