1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 07:39:43 +02:00

Improve attachment and link handling

This commit is contained in:
Harvey Kandola 2019-01-16 16:55:43 +00:00
parent 6c07d2e569
commit b6d9c54667
8 changed files with 762 additions and 740 deletions

View file

@ -66,13 +66,7 @@ export default Service.extend(Notifier, {
result = `<a data-documize='true' data-link-space-id='${link.spaceId}' data-link-id='${link.id}' data-link-target-document-id='${link.documentId}' data-link-target-id='${link.targetId}' data-link-type='${link.linkType}' href='${href}'>${link.title}</a>`;
}
if (link.linkType === "file") {
// For authenticated users we send server auth token.
let qry = '';
if (this.get('session.authenticated')) {
qry = '?token=' + this.get('session.authToken');
}
href = `${endpoint}/public/attachment/${orgId}/${link.targetId}${qry}`;
href = `${endpoint}/public/attachment/${orgId}/${link.targetId}`;
result = `<a data-documize='true' data-link-space-id='${link.spaceId}' data-link-id='${link.id}' data-link-target-document-id='${link.documentId}' data-link-target-id='${link.targetId}' data-link-type='${link.linkType}' href='${href}'>${link.title}</a>`;
}
if (link.linkType === "network") {
@ -136,8 +130,16 @@ export default Service.extend(Notifier, {
// handle attachment links
if (link.linkType === "file") {
// For authenticated users we send server auth token.
let qry = '';
if (this.get('session.hasSecureToken')) {
qry = '?secure=' + this.get('session.secureToken');
} else if (this.get('session.authenticated')) {
qry = '?token=' + this.get('session.authToken');
}
link.url = link.url.replace('attachments/', 'attachment/');
window.location.href = link.url;
window.location.href = link.url + qry;
return;
}