Skip to content

Conversation

@FrancescoMolinaro
Copy link
Contributor

@FrancescoMolinaro FrancescoMolinaro commented Nov 14, 2025

References

Related to DSpace/RestContract#318
Related to DSpace/DSpace#11549

Description

This PR migrates the custom URL feature from DSpace-CRIS to core DSpace, allowing to define a custom url of item in submission.

Instructions for Reviewers

The custom URL feature allows items to have human-friendly URLs instead of UUID-based paths.
To test it a rest config for the newly introduced section must be in place.

ref: DSpace/DSpace#11549 (comment)

Once the section is configured the user can provide a value for the custom url in submission.
After the item has been deposited it will be possible to access it via the custom url, e.g. /entities/person/customUrlValue

List of changes in this PR:

Adapted item resolver.
New submission section for custom url.

Additional change:

Fixed sync-i18n script (broken after latest updates on main)
Executed sync on labels.

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using npm run lint
  • My PR doesn't introduce circular dependencies (verified via npm run check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • My PR aligns with Accessibility guidelines if it makes changes to the user interface.
  • My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

@FrancescoMolinaro FrancescoMolinaro marked this pull request as draft November 14, 2025 16:37
@FrancescoMolinaro FrancescoMolinaro changed the title Task/main/duracom 413 Implement custom url functionality Nov 14, 2025
@FrancescoMolinaro FrancescoMolinaro changed the title Implement custom url functionality MERGER: porting creation of a custom URL for Items Nov 19, 2025
@FrancescoMolinaro FrancescoMolinaro marked this pull request as ready for review November 19, 2025 15:51
@github-actions
Copy link

Hi @FrancescoMolinaro,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

@tdonohue tdonohue added DSpace-CRIS merger This ticket/PR relates to the merger of DSpace-CRIS into DSpace. new feature labels Dec 1, 2025
@tdonohue tdonohue moved this to 🙋 Needs Reviewers Assigned in DSpace 10.0 Release Dec 1, 2025
@tdonohue tdonohue requested a review from kskaiser December 4, 2025 17:48
@github-actions
Copy link

Hi @FrancescoMolinaro,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

@github-project-automation github-project-automation bot moved this from 🙋 Needs Reviewers Assigned to 👀 Under Review in DSpace 10.0 Release Dec 17, 2025
@tdonohue tdonohue changed the title MERGER: porting creation of a custom URL for Items [DSpace-CRIS] Creation of a custom URL for Items Jan 13, 2026
@saschaszott
Copy link
Contributor

saschaszott commented Jan 16, 2026

We have found several places in the Angular code that cannot handle the case where a custom URL is used in the URL instead of an item’s UUID. For example, when a custom URL exists, no bundle can be created (in the file administration of the item).

The corresponding component assumes that a UUID is present in the URL:

https://github.com/4Science/dspace-angular/blob/1055dc74f90baeb8855bef62f1828d2de280f3c4/src/app/item-page/bitstreams/upload/upload-bitstream.component.ts#L153

There was also a bug in DSpace CRIS 7 and 8 when accessing the item administration if a custom URL existed (4Science#124). This bug was fixed in the latest DSpace CRIS 8 release.

Before merging this PR, the frontend should be systematically tested with items that have a custom URL.

@saschaszott
Copy link
Contributor

saschaszott commented Jan 16, 2026

A code search for .params.id yields more than 50 results. These occurrences could potentially cause issues with custom URLs in cases where the invocation relies on the id parameter of the route.

@FrancescoMolinaro
Copy link
Contributor Author

Hi @saschaszott , thanks for the feedback, I have pushed some changes to the item page resolver so to enforce the uuid in case of an administrative view (also bitstreams upload).

In this way we should keep all the older behaviours and mechanisms active; I have also checked the other occurencies of "params.id" and they would seem covered by the change to the item data service or not affected by the custom url (e.g. access control, workspace, etc.)

If this would be approved I will propagate the change aslo on the CRIS codebase.

I wanted also to inform that this feature is used on CRIS only on Person items and that is most likely the reason why certain aspect weren't considered, nevertheless I agree that the introduction of the feature shouldn't compromise existing behaviours.

@FrancescoMolinaro
Copy link
Contributor Author

Hi @tdonohue , @artlowel the PR should now be clean from the i18n changes, I have kept the changes done to the german file since the translations were already provided by @pnbecker .

Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

@FrancescoMolinaro : I'm testing this feature today and overall it works. But, I've run into one very severe bug and several other major bugs.

  1. First, Item Versioning appears to be entirely incompatible with this feature. After versioning an Item, it's no longer accessible in the UI at all. The Item is corrupted and can only be edited or seen again by reverting these PRs. Here's how to reproduce it:
    • First, create a new Publication with these PRs enabled.
    • Verify the Publication custom URL is working fine and is based off the Item title.
    • Now, create a Version 2 of that Item. In the submission form make a minor change (e.g. reorder authors or add a new author). Complete the versioning.
    • Go back to that Item using its custom URL. The item will appear, but you'll see a message saying "This is not the latest version".
    • Click the link in that message, and now you'll see a page that says "Error fetching item" like this one: Image
    • At this point, it's impossible to edit or view the Item. It will still appear in search/browse. However, if you click "View" then you'll always see that error. If you attempt to use the Item Handle or UUID you'll also see that error. The item is corrupted and cannot be fixed or edited except via the database. (See update in next line)
    • UPDATE: I've figured out that I can still get to the corrupted item if I locate it's UUID and go directly to the /edit path for the item, e.g. http://localhost:4040/entities/publication/[uuid]/edit. But it's inaccessible from http://localhost:4040/entities/publication/[uuid], In order to "uncorrupt" the item it appears I have to delete the dspace.customurl metadata field.
    • UPDATE 2: If I delete the dspace.customurl metadata field from the latest version then the item is accessible again. But, what I see is that the latest version (version 2) uses the UUID (as expected) and the early version (version 1) uses the original "custom url". So, I suspect the bug here is that there's a custom url conflict between version 1 and version 2 (i.e. both versions appear to be trying to use the same Custom URL).
  2. This feature is also not compatible with the "Audit Trail" feature. As soon as an Item has a custom URL, you can no longer access the Audit Trail specific to that item. (Could be moved to a ticket)
    • Visit the Item page as an Admin, and using the menu select "Audit" for that item.
    • You'll get an empty page. If you make a change to the Item, the Audit page remains empty.
  3. This feature is also not compatible with Signposting. If Signposting is enabled, then you'll see 404 errors in your browser's DevTools "Network" tab when you visit the Item page. It appears the signposting requests are sent using the custom URL instead of the UUID, which may be the cause of the 404. (Could be moved to a ticket)
  4. Invalid Item URLs now all return 200 OK. This is a major SEO issue. Try entering an invalid custom url like: http://localhost:4000/entities/publication/thisisnotvalid and you'll see you get a 200 OK and a blank page.
    • (Could be moved to a ticket)

I also have to admit, I'm a bit worried that when these custom URLs fail there's no way to access the item at all because the UUID and the Handle all redirect to the custom URL. Is there a reason we don't allow direct access via UUID or Handle if the custom URL is invalid or failing? The current behavior means the item acts as if it's "corrupted" and is inaccessible except by the database. That makes it frustrating to fix these invalid or broken custom URLs. (I'm ok with logging this as a separate ticket, but I feel we must find a better solution).

(I meant to add, I'm OK with moving some/all of these to follow-up tickets. The most frustrating one is the Item Versioning though, as I have corrupted items that are difficult to fix. But, overall the feature does work...it's just not as well integrated as it could be)

I'm still testing & reviewing code.. so this is only a partial review. But, I wanted to share these errors that I've already found.

Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

@FrancescoMolinaro : I finished my code review of the frontend. Overall, the code looks good. I did find a few things inline that I wanted to note. These are mostly minor, but one may need to be turned into a ticket.

I also wanted to note that the e2e test failures in this PR might be related to the recent updates to the Docker images (especially the JDK 21 update)...as it appears the Docker images are failing to start properly. You may want to rebase this on latest main to see if the test failures go away. (Locally, I'm having no issues running these feature PRs in Docker, so I suspect a rebase might fix the issue)

@FrancescoMolinaro
Copy link
Contributor Author

FrancescoMolinaro commented Feb 2, 2026

Hi @tdonohue , many thanks for the review and the feedback.

I checked the issues that you mentioned and there were still some discrepancy with the CRIS code that weren't included in this PR.
With the latest changes the issues have been resolved as follows:

  1. Audit page -> read the uuid from the dso in the route data instead than relying on the id param.
  2. Version -> moved version route on top of the list so that the version resolver runs before the item resolver.
  3. Sub-route -> I have adapted the item resolver so that the url is not changed if the user is navigating to a sub route of the item page (/full excluded)
  4. Signposting -> Added a new resolver that handles the liks resolution separately from the route id param. (already present on CRIS)

I have also rebased the branch with main and cleaned up eventual conflicts in the history.

Regarding instead the SEO issue with the 200 code returned on invalid urls like http://localhost:4000/entities/publication/thisisnotvalid , it will addressed via a REST fix, as the new search method (findByCustomURL) is currently returning an empy object and not a formatted response with error code as it should.

e.g.

{ "timestamp": "2026-02-02T13:05:07.188+00:00", "status": 404, "error": "Not Found", "message": "An exception has occurred", "path": "/server/api/core/items/search/findByHref" }

I addition I have added a new operator to get a proper redirect on response with no-content (code 204).

Copy link
Member

Choose a reason for hiding this comment

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

@FrancescoMolinaro : You are accidentally removing three new (recently added) translations. Please restore the ml.json5, od.json5 and te.json5 files in this PR

Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

@FrancescoMolinaro : I've retested this today with the backend PR (DSpace/DSpace#11549) and found that all of my previously reported bugs are now fixed.

This PR now looks good to me and I'm a +1 once two minor things are fixed:

  1. Please restore the three *.json5 files you are accidentally removing in this PR. See this comment that I submitted separately
  2. Please fix the two new lint errors caused by your last commit.

Beyond that, this feature is working well and I feel it's ready to be merged.

@tdonohue tdonohue changed the title [DSpace-CRIS] Creation of a custom URL for Items [DSpace-CRIS] Creation of a custom URL for Items (Frontend) Feb 3, 2026
@tdonohue tdonohue requested a review from nwoodward February 3, 2026 17:55
@FrancescoMolinaro
Copy link
Contributor Author

FrancescoMolinaro commented Feb 4, 2026

Hi @tdonohue , many thanks for the feedback and sorry about the translation files, I must have made a rebasing mistake.
I have reintroduced the files and fixed the lint issues, in addition I noticed a caching issue with the custom url request when a new version of the item is created, to reproduce:

  1. click on create new version of an Item with custom url
  2. deposit item and click on "View" button in the myDspace search results -> the page will load the older version of the item

To solve this issue I have added a new method for the cache invalidation that will be executed only if the item has the custom url, after the new version is created (open submission).

Hopefully this PR is now in a clean state to be merged, thanks again for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DSpace-CRIS merger This ticket/PR relates to the merger of DSpace-CRIS into DSpace. high priority new feature

Projects

Status: 👀 Under Review

Development

Successfully merging this pull request may close these issues.

5 participants