DSpace / dspace-angular

DSpace User Interface built on Angular.io
https://wiki.lyrasis.org/display/DSDOC8x/
BSD 3-Clause "New" or "Revised" License
130 stars 426 forks source link

URI link on simple item page always opens in a new page/tab #3241

Open saiful-semantic opened 2 months ago

saiful-semantic commented 2 months ago

Describe the bug

In DSpace 8.0, the URI link on item page always opens in a new page.

To Reproduce

Steps to reproduce the behavior:

  1. Deploy DSpace Angular UI on a reverse proxy setup with FQDN
  2. Then open any item page page. e.g. https://demo.dspace.org/items/f1e9085d-048c-4203-b769-b7350f56c7a3
  3. Click on the URI. e.g.: https://demo.dspace.org/handle/10673/1431 It will open a new page despite the item being within the same domain.

Expected behavior

Ideally links belonging to the same FQDN should open within the same page.

Related work

On digging further I think the reason is hasInternalLink function.

In lines 134-136 of src/app/item-page/field-components/metadata-values/metadata-values.component.ts:

hasInternalLink(linkValue: string): boolean {
   return linkValue.startsWith(environment.ui.baseUrl);
}

When we use a reverse proxy for the UI (as in most production deployments), this function always returns a false value. e.g., environment.ui.baseUrl = http://localhost:4000 linkValue = https://production-domain/handle/x/xx [assuming the fake handle]

This makes each URI in simple item page opening in a new window/tab.

Andrea-Guevara commented 1 month ago

Good afternoon @tdonohue! My name is Andrea and I'm part of Neki-it. We want to do this activity.

tdonohue commented 1 month ago

Thanks @Andrea-Guevara . I'll assign this to you for your team. Please let us know on this ticket if you need advice on any solution you may be working on.

Andrea-Guevara commented 1 month ago

Good afternoon @tdonohue! I was able to reproduce this error a few days ago, but now I can't reproduce the error on https://demo.dspace.org which is on version 8.

I was wondering if this is still a problem?

saiful-semantic commented 1 month ago

I was wondering if this is still a problem?

Yes it still is. Try clicking on the URI in this page: https://demo.dspace.org/handle/10673/1470

Andrea-Guevara commented 1 month ago

Good morning @saiful-semantic, I hope you're well!

We have provided a PR as a possible solution to this problem. If necessary, we welcome suggestions for improving the code.

We look forward to your feedback!