mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-12 09:37:04 +01:00
Fix: include base href when opening global search result in new window (#10066)
This commit is contained in:
parent
f39463ff4e
commit
c40a7751b9
2 changed files with 19 additions and 4 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { NgTemplateOutlet } from '@angular/common'
|
||||
import { LocationStrategy, NgTemplateOutlet } from '@angular/common'
|
||||
import {
|
||||
Component,
|
||||
ElementRef,
|
||||
|
|
@ -99,7 +99,8 @@ export class GlobalSearchComponent implements OnInit {
|
|||
private permissionsService: PermissionsService,
|
||||
private toastService: ToastService,
|
||||
private hotkeyService: HotKeyService,
|
||||
private settingsService: SettingsService
|
||||
private settingsService: SettingsService,
|
||||
private locationStrategy: LocationStrategy
|
||||
) {
|
||||
this.queryDebounce = new Subject<string>()
|
||||
|
||||
|
|
@ -421,10 +422,13 @@ export class GlobalSearchComponent implements OnInit {
|
|||
extras: Object = {}
|
||||
) {
|
||||
if (newWindow) {
|
||||
const url = this.router.serializeUrl(
|
||||
const serializedUrl = this.router.serializeUrl(
|
||||
this.router.createUrlTree(commands, extras)
|
||||
)
|
||||
window.open(url, '_blank')
|
||||
const baseHref = this.locationStrategy.getBaseHref()
|
||||
const fullUrl =
|
||||
baseHref.replace(/\/+$/, '') + '/' + serializedUrl.replace(/^\/+/, '')
|
||||
window.open(fullUrl, '_blank')
|
||||
} else {
|
||||
this.router.navigate(commands, extras)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue