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

Fix: ALLOWED_HOSTS logic being overwritten when * is set #3218

Merged
merged 3 commits into from Apr 27, 2023

Conversation

ikaruswill
Copy link

@ikaruswill ikaruswill commented Apr 27, 2023

Proposed change

  1. If ALLOWED_HOSTS = ["*"], do nothing
  2. If ALLOWED_HOSTS != ["*"] append localhost
  3. If ALLOWED_HOSTS != ["*"] and PAPERLESS_URL is defined, append localhost and _paperless_uri.hostname

Fixes #3214

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other (please explain)

Checklist:

  • I have read & agree with the contributing guidelines.
  • If applicable, I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.
  • If applicable, I have checked that all tests pass, see documentation.
  • I have run all pre-commit hooks, see documentation.
  • I have made corresponding changes to the documentation as needed.
  • I have checked my modifications for any breaking changes.

@ikaruswill ikaruswill requested a review from a team as a code owner April 27, 2023 18:18
@paperless-ngx-secretary paperless-ngx-secretary bot added backend documentation Improvements or additions to documentation small-change labels Apr 27, 2023
@github-actions github-actions bot added the bug Bug report or a Bug-fix label Apr 27, 2023
Copy link
Member

@shamoon shamoon left a comment

Choose a reason for hiding this comment

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

This makes sense to me, thanks

@shamoon shamoon removed the documentation Improvements or additions to documentation label Apr 27, 2023
@shamoon shamoon added this to the v1.14.3 milestone Apr 27, 2023
@codecov
Copy link

codecov bot commented Apr 27, 2023

Codecov Report

Merging #3218 (83344f7) into dev (daaeb36) will increase coverage by 0.00%.
The diff coverage is 33.33%.

@@           Coverage Diff           @@
##              dev    #3218   +/-   ##
=======================================
  Coverage   93.34%   93.34%           
=======================================
  Files         156      156           
  Lines        6656     6657    +1     
=======================================
+ Hits         6213     6214    +1     
  Misses        443      443           
Flag Coverage Δ
backend 93.34% <33.33%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/paperless/settings.py 85.55% <33.33%> (+0.05%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@stumpylog stumpylog left a comment

Choose a reason for hiding this comment

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

Seems good to me as well. We can ignore the patch coverage failure. settings isn't covered for this sort of setup

@ikaruswill
Copy link
Author

Sorry spotted something hang on.

@ikaruswill
Copy link
Author

Sorry folks it's 3:24AM here, I guess coding at night isn't a great idea.

Before:

ALLOWED_HOSTS.append(["localhost"])

I was appending a list to a list. But it should be appending a host as a string to the list.

ALLOWED_HOSTS.append("localhost")

@shamoon
Copy link
Member

shamoon commented Apr 27, 2023

Appreciate you catching that syntax thing!

@shamoon shamoon merged commit d2a8076 into paperless-ngx:dev Apr 27, 2023
16 of 17 checks passed
@github-actions
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 28, 2023
@ikaruswill ikaruswill deleted the fix/issue-3214 branch May 28, 2023 04:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backend bug Bug report or a Bug-fix small-change
Projects
None yet
3 participants