mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-18 01:41:14 -06:00
Fix: share links for URLs containing 'api' incorrect in dropdown (#4701)
This commit is contained in:
@@ -192,4 +192,24 @@ describe('ShareLinksDropdownComponent', () => {
|
||||
component.share(link)
|
||||
// expect(navigatorSpy).toHaveBeenCalledWith({ url: component.getShareUrl(link) })
|
||||
})
|
||||
|
||||
it('should correctly generate share URLs', () => {
|
||||
environment.apiBaseUrl = 'http://example.com/api/'
|
||||
expect(component.getShareUrl({ slug: '123abc123' } as any)).toEqual(
|
||||
'http://example.com/share/123abc123'
|
||||
)
|
||||
environment.apiBaseUrl = 'http://example.domainwithapiinit.com/api/'
|
||||
expect(component.getShareUrl({ slug: '123abc123' } as any)).toEqual(
|
||||
'http://example.domainwithapiinit.com/share/123abc123'
|
||||
)
|
||||
environment.apiBaseUrl = 'http://example.domainwithapiinit.com:1234/api/'
|
||||
expect(component.getShareUrl({ slug: '123abc123' } as any)).toEqual(
|
||||
'http://example.domainwithapiinit.com:1234/share/123abc123'
|
||||
)
|
||||
environment.apiBaseUrl =
|
||||
'http://example.domainwithapiinit.com:1234/subpath/api/'
|
||||
expect(component.getShareUrl({ slug: '123abc123' } as any)).toEqual(
|
||||
'http://example.domainwithapiinit.com:1234/subpath/share/123abc123'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user