1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Fixing sharing link url on the admin page fixes #631

This commit is contained in:
Patrik J. Braun 2023-03-10 00:00:30 +01:00
parent 64dd94fe6a
commit 080455cdc1
4 changed files with 6 additions and 3 deletions

View File

@ -129,7 +129,7 @@ export class Utils {
url += part + '/';
}
url = url.replace(new RegExp('/+', 'g'), '/');
url = url.replace(/(https?:\/\/)|(\/){2,}/g, "$1$2")
if (url.trim() === '') {
url = './';

View File

@ -20,7 +20,7 @@
</thead>
<tbody>
<tr *ngFor="let share of shares">
<td><a [href]="sharingUrl + share.sharingKey">{{share.sharingKey}}</a></td>
<td><a [href]="sharingUrl + share.sharingKey">{{share.sharingKey}}</a>,{{sharingUrl}}</td>
<td>{{share.path}}</td>
<td>{{share.creator.name}}</td>
<td>{{share.expires | date}}</td>

View File

@ -13,12 +13,12 @@ import {Utils} from '../../../../../common/Utils';
export class SharingsListComponent implements OnInit {
public shares: SharingDTO[] = [];
public sharingUrl = Utils.concatUrls(Config.Server.publicUrl, '/share') + '/';
constructor(public sharingList: SharingListService,
private settingsService: SettingsService) {
}
sharingUrl = Utils.concatUrls(Config.Server.publicUrl, '/share/');
ngOnInit(): void {
this.getSharingList();

View File

@ -16,6 +16,9 @@ describe('Utils', () => {
expect(Utils.concatUrls('abc/', '/cde/')).to.be.equal('abc/cde');
expect(Utils.concatUrls('abc\\/', '/cde/')).to.be.equal('abc/cde');
expect(Utils.concatUrls('abc\\/', '/cde/', 'fgh')).to.be.equal('abc/cde/fgh');
expect(Utils.concatUrls('abc\\/', '////cde/', 'fgh')).to.be.equal('abc/cde/fgh');
expect(Utils.concatUrls('http://abc\\/', '/cde/', 'fgh')).to.be.equal('http://abc/cde/fgh');
expect(Utils.concatUrls('https://abc\\/', '/cde/', 'fgh')).to.be.equal('https://abc/cde/fgh');
});
it('should find closest number', () => {