Skip to content

Commit

Permalink
Remove full URL inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
edfletcher committed Nov 17, 2024
1 parent c79b731 commit 3d7886d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
3 changes: 1 addition & 2 deletions discord/events/messageCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ module.exports = async (context, data) => {
return cRes.attachmentURLShort ?? cRes.attachmentURL;
}

const { cachedURLShort, cachedURL } = cRes;
return cachedURLShort ? `${cachedURLShort} (${cachedURL})` : cachedURL;
return cRes.cachedURLShort ?? cRes.cachedURL;
});

if (failures.length) {
Expand Down
5 changes: 1 addition & 4 deletions http.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,7 @@ redisListener.subscribe(PREFIX, (err) => {
await finished(Readable.fromWeb(fetchRes.body).pipe(outStream));
console.log(`Cached attachment ${newId} from source ${attachmentURL}`);
data.cachedURL = config.http.proto + '://' + config.http.fqdn + '/attachments/' + newId;

if (config.http.shrtnHost) {
data.cachedURLShort = await createShrtned(data.cachedURL);
}
data.cachedURLShort = await createShrtned(data.cachedURL);
} catch (e) {
console.error(`Fetching or persisting ${attachmentURL} failed:`, e.message);
console.error(e);
Expand Down

0 comments on commit 3d7886d

Please sign in to comment.