repair file sharing hopefully

This commit is contained in:
Raven Scott 2024-06-09 05:40:37 -04:00
parent b46ca2b2df
commit 3042974e55

6
app.js
View File

@ -338,7 +338,7 @@ function addFileMessage(from, fileName, fileUrl, fileType, avatar) {
$div.classList.add('message'); $div.classList.add('message');
const $img = document.createElement('img'); const $img = document.createElement('img');
$img.src = avatar || 'https://via.placeholder.com/40'; $img.src = updatePortInUrl(avatar) || 'https://via.placeholder.com/40';
$img.classList.add('avatar'); $img.classList.add('avatar');
$div.appendChild($img); $div.appendChild($img);
@ -352,13 +352,13 @@ function addFileMessage(from, fileName, fileUrl, fileType, avatar) {
if (fileType.startsWith('image/')) { if (fileType.startsWith('image/')) {
const $image = document.createElement('img'); const $image = document.createElement('img');
$image.src = fileUrl; $image.src = updatePortInUrl(fileUrl);
$image.alt = fileName; $image.alt = fileName;
$image.classList.add('attached-image'); $image.classList.add('attached-image');
$content.appendChild($image); $content.appendChild($image);
} else { } else {
const $fileLink = document.createElement('a'); const $fileLink = document.createElement('a');
$fileLink.href = fileUrl; $fileLink.href = updatePortInUrl(fileUrl);
$fileLink.textContent = `File: ${fileName}`; $fileLink.textContent = `File: ${fileName}`;
$fileLink.download = fileName; $fileLink.download = fileName;
$content.appendChild($fileLink); $content.appendChild($fileLink);