Skip to content

Commit

Permalink
Use Location.joinWithSlash() to normalize the urls
Browse files Browse the repository at this point in the history
  • Loading branch information
reiterl committed Apr 24, 2024
1 parent 204a66d commit 6a7e2ad
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Location } from '@angular/common';
import { Injectable } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Content, ContentTable, ContentText, TableCell } from 'pdfmake/interfaces';
Expand Down Expand Up @@ -740,10 +741,7 @@ export class MotionPdfService {
private createAttachments(motion: ViewMotion): object {
let width = this.pdfDocumentService.pageSize === `A5` ? PDF_A5_POINTS_WIDTH : PDF_A4_POINTS_WIDTH;
width = width - this.pdfDocumentService.pageMarginPointsLeft - this.pdfDocumentService.pageMarginPointsRight;
let instancUrl = this.organizationSettingsService.instant(`url`);
if (instancUrl.endsWith(`/`)) {
instancUrl = instancUrl.slice(0, -1);
}
const instancUrl = this.organizationSettingsService.instant(`url`);

const attachments = [];
attachments.push({
Expand All @@ -766,8 +764,8 @@ export class MotionPdfService {
attachments.push({
ul: [
{
text: attachment.getTitle() + `: ` + instancUrl + fileUrl,
link: instancUrl + fileUrl,
text: attachment.getTitle() + `: ` + Location.joinWithSlash(instancUrl, fileUrl),
link: Location.joinWithSlash(instancUrl, fileUrl),
margin: [0, 0, 0, 5]
}
]
Expand Down

0 comments on commit 6a7e2ad

Please sign in to comment.