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

Data-importer: Welcome page submits form to incomplete URL #6354

Closed
3 of 4 tasks
riversdev0 opened this issue Aug 19, 2022 · 3 comments
Closed
3 of 4 tasks

Data-importer: Welcome page submits form to incomplete URL #6354

riversdev0 opened this issue Aug 19, 2022 · 3 comments
Labels
bug Verified and replicated bugs and issues.

Comments

@riversdev0
Copy link

riversdev0 commented Aug 19, 2022

Support guidelines

I've found a bug and checked that ...

Description

Despite better advice, when self-hosting the FIDI tool on the same Apache virtual host as Firefly, the HTML Form tag action attribute lacks a trailing slash after the path. I acknowledge that FIDI wasn't intended to be run on the same virtual host, nor in a sub-directory. However, I suspect a trivial number of seconds of analysis from the author could probably enable this ability. I was not able to locate the spot in the code myself, which is why I'm reaching out for help.

Expected behaviour

In an ideal world, the app would be completely agnostic of its own location on the server, both with respect to the host header and the request path. And, it turns out, the app has nearly achieved that goal (yay!).

Debug information

Debug information is likely not relevant to this issue. I can absolutely provide anything you might need, if you let me know what you want to see.

Steps to reproduce

  1. Install a self-hosted instance of Firefly directly on Linux with Apache, following the guidance provided here. The app goes into /var/www/firefly-iii.
  2. Install a self-hosted instance of the Data Importer on the same server, following the guidance provided here. The app goes into /var/www/data-importer.
  3. Configure Apache with a virtual host where the DocumentRoot is /var/www/firefly-iii/public. Add this line to the virtual host: Alias /importer /var/www/data-importer/public.
  4. Point your web browser at the data importer. For example, http://firefly.hh.local/importer/. Be sure to use the trailing slash.
  5. Observe the page successfully loads. Click the 'Import File' button. The page reloads exactly as it was.
    image
  6. Open the bowser's Inspector; click the 'Network' tab. In the web app, click the 'Import File' button again. On the 'Network' tab, you can see that a POST was generated to '/importer'. The response was a 301 to '/importer/'.
    image
  7. In the browser's Inspector, click the 'Inspector' tab. Observe the URL in the form action. Edit the URL so that it includes a trailing slash.
    image
    image
  8. In the web app, click the 'Import File' button again. Observe that it proceeds to the file upload screen.
  9. (Optional) Proceed with file upload, import, and verification. It works!

Additional info

I am happy and willing to submit a pull request to add detection logic for hosting in a sub-directory. But, I am not able to locate the relevant code section. I also attempted to fix this using the .htaccess file, but I did not have success detecting a POST and avoiding the [R] flag.

JC5 added a commit to firefly-iii/data-importer that referenced this issue Aug 20, 2022
@JC5
Copy link
Member

JC5 commented Aug 20, 2022

Thanks, I pushed a fix to the develop branch. Let me know if it works for you. 👍🏻

@JC5 JC5 added the bug Verified and replicated bugs and issues. label Aug 20, 2022
@riversdev0
Copy link
Author

Yes, that solution works! I also tested for regression using a dedicated domain name, as well as pointing the DocumentRoot to the folder above public (which doesn't have a redirect like Firefly does), and everything appears to work the same as previously or better. Thank you so much!

@github-actions
Copy link
Contributor

Hi there! This is an automatic reply. Share and enjoy

This issue is now closed. Please be aware that closed issues are not actively monitored. If you reply, you may get no response.

  • If the original bug is not actually fixed, please feel free to open a new ticket. Please refer to this issue for clarity.
  • Follow-up questions can also be posted in a new discussion

Thank you for your consideration.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Verified and replicated bugs and issues.
Projects
None yet
Development

No branches or pull requests

2 participants