File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/app/shared/clarin-item-box-view Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -147,16 +147,21 @@ export class ClarinItemBoxViewComponent implements OnInit {
147147 this . itemUri = getItemPageRoute ( this . item ) ;
148148 this . itemDescription = this . item ?. firstMetadataValue ( 'dc.description' ) ;
149149 this . itemPublisher = this . item ?. firstMetadataValue ( 'dc.publisher' ) ;
150- this . publisherRedirectLink = this . baseUrl + '/search?f.publisher=' + encodeURIComponent ( this . itemPublisher )
151- + ',equals' ;
152150 this . itemDate = this . clarinDateService . composeItemDate ( this . item ) ;
153151
154152 await this . assignBaseUrl ( ) ;
153+ this . publisherRedirectLink = this . getSearchEndpoint ( ) + '?f.publisher=' + encodeURIComponent ( this . itemPublisher )
154+ + ',equals' ;
155155 this . getItemCommunity ( ) ;
156156 this . loadItemLicense ( ) ;
157157 this . getItemFilesSize ( ) ;
158158 }
159159
160+ private getSearchEndpoint ( ) : string {
161+ // Return the search endpoint URL for with the base URL. Remove trailing slashes to ensure a clean URL.
162+ return this . baseUrl . replace ( / \/ + $ / , '' ) + '/search' ;
163+ }
164+
160165 private getItemFilesSize ( ) {
161166 if ( isNull ( this . item ) ) {
162167 return ;
@@ -193,8 +198,7 @@ export class ClarinItemBoxViewComponent implements OnInit {
193198 . pipe ( getFirstSucceededRemoteDataPayload ( ) )
194199 . subscribe ( ( community : Community ) => {
195200 this . itemCommunity . next ( community ) ;
196- const encodedRedirectLink = this . baseUrl +
197- '/search?f.items_owning_community=' + encodeURIComponent ( this . dsoNameService . getName ( community ) ) + ',equals' ;
201+ const encodedRedirectLink = this . getSearchEndpoint ( ) + '?f.items_owning_community=' + encodeURIComponent ( this . dsoNameService . getName ( community ) ) + ',equals' ;
198202 this . communitySearchRedirect . next ( encodedRedirectLink ) ;
199203 } ) ;
200204 } ) ;
You can’t perform that action at this time.
0 commit comments