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

Check targetUrlResolved against PRIVATE_BY_POLICY_DOMAINS #3405

Merged
merged 3 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ services:
- scoop_rest_api_internal

scoop-rest-api:
image: registry.lil.tools/harvardlil/scoop-rest-api:13-7077f40b8607621df9827f31bba4e7d4
image: registry.lil.tools/harvardlil/scoop-rest-api:15-36faf86818fcb2094e47cfe37c443515
init: true
tty: true
depends_on:
Expand Down
10 changes: 5 additions & 5 deletions perma_web/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def handler500(request):
urlpatterns += [re_path(r'^__debug__/', include(debug_toolbar.urls))]

# views that only load when running our tests:
# if settings.TESTING:
from .tests import views as test_views
urlpatterns += [
re_path(r'tests/redirect-to-file$', test_views.redirect_to_file, name='redirect_to_file')
]
if settings.TESTING:
from .tests import views as test_views
urlpatterns += [
re_path(r'tests/redirect-to-file$', test_views.redirect_to_file, name='redirect_to_file')
]
10 changes: 5 additions & 5 deletions perma_web/perma/celery_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,11 +847,11 @@ def save_scoop_capture(link, capture_job, data):
])

# Make this link private by policy, if the captured domain is on the list.
# For now, just check the primary URL, since Scoop does not yet expose the URL
# that the capture request resolved to.
content_url = data['scoop_capture_summary']['exchangeUrls'][0]
if any(domain in content_url for domain in settings.PRIVATE_BY_POLICY_DOMAINS):
safe_save_fields(link, is_private=True, private_reason='domain')
target_url = data['scoop_capture_summary']['targetUrl']
content_url = data['scoop_capture_summary']['targetUrlResolved']
for url in [target_url, content_url]:
if any(domain in url for domain in settings.PRIVATE_BY_POLICY_DOMAINS):
safe_save_fields(link, is_private=True, private_reason='domain')

# See if the primary URL has been munged in any way since we last saw it.
if link.primary_capture.url != data['scoop_capture_summary']['exchangeUrls'][0]:
Expand Down
Loading