MENDELU/Add "Allow external URLs" toggle to collection Content Source (#860) - #1414
Open
milanmajchrak wants to merge 1 commit into
Open
MENDELU/Add "Allow external URLs" toggle to collection Content Source (#860)#1414milanmajchrak wants to merge 1 commit into
milanmajchrak wants to merge 1 commit into
Conversation
Collection > Edit > Content Source now shows an "Allow external URLs" checkbox when the harvest type is "Harvest metadata and bitstreams", together with a short description of what it does and what the risk is when it is ticked (dataquest-dev/dspace-customers#860). The checkbox is a plain template control rather than a dynamic form control, so it reverts correctly on Discard/Reinstate - the form's patchValue only names the three existing containers. The warning renders whenever the harvest type matches, not only when the box is ticked, because the administrator needs to read it before ticking; the alert styling appears only in the risky state. Requires the matching backend change; the REST field is allow_external_urls. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds UI support for the new allow_external_urls flag on a collection’s Content Source settings, enabling administrators to explicitly allow harvesting bitstreams from external hosts (with clear risk messaging and accessibility support). This aligns the Angular UI with the backend support introduced in the referenced backend PR.
Changes:
- Add
ContentSource.allowExternalUrls(autoserialized asallow_external_urls) with a deliberatefalsedefault. - Extend the Collection → Edit → Content Source UI to show an Allow external URLs checkbox and a descriptive warning when harvest type is METADATA_AND_BITSTREAMS.
- Add unit tests covering visibility, toggling behavior, update dispatch, and
aria-describedbylinkage; add EN/CS translations for the new label and warning text.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/assets/i18n/en.json5 | Adds English label + warning translations for the new checkbox/help text. |
| src/assets/i18n/cs.json5 | Adds Czech label + warning translations (others fall back to EN). |
| src/app/core/shared/content-source.model.ts | Introduces allowExternalUrls with @autoserializeAs('allow_external_urls') and default false. |
| src/app/collection-page/edit-collection-page/collection-source/collection-source.component.ts | Adds harvest-type constant for the template and a handler to toggle + persist the flag via field updates. |
| src/app/collection-page/edit-collection-page/collection-source/collection-source.component.spec.ts | Adds test coverage for UI presence/absence, styling, aria description, and update calls. |
| src/app/collection-page/edit-collection-page/collection-source/collection-source.component.html | Renders the checkbox + warning block conditionally and styles the warning only in the risky state. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem description
Issue: https://github.com/dataquest-dev/dspace-customers/issues/860
UI part of the fix. Adds the Allow external URLs checkbox to Collection → Edit → Content Source, with a short note on what it does and what the risk is when it is ticked.
Analysis
The checkbox only shows for "Harvest metadata and bitstreams", since that is the only type that downloads files. Unticked it renders as plain help text, ticked it renders as a warning, so the two states cannot be confused. The note is tied to the checkbox with
aria-describedby.It is a plain checkbox rather than a dynamic form control — the form's
patchValueonly covers the three existing containers, so a dynamic control would not revert on Discard.Needs the backend: dataquest-dev/DSpace#1387. Merge that one first, otherwise the UI reports success while nothing is saved.
Manual Testing (if applicable)
860-1-allow-external-urls-control.mp4
860-2-ssrf-guard-in-action.mp4
Copilot review