Fix reddit slash command text input, make filename detection split on last period

This commit is contained in:
Essem 2022-07-30 20:21:06 -05:00
parent f3eea0d96a
commit b0f4c16d50
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
4 changed files with 8 additions and 3 deletions

View file

@ -39,11 +39,12 @@ const videoFormats = ["video/mp4", "video/webm", "video/mov"];
const getImage = async (image, image2, video, extraReturnTypes, gifv = false, type = null, link = false) => {
try {
const fileNameSplit = new URL(image).pathname.split("/");
const fileName = fileNameSplit[fileNameSplit.length - 1].split(".")[0];
const fileName = fileNameSplit[fileNameSplit.length - 1];
const fileNameNoExtension = fileName.slice(0, fileName.lastIndexOf("."));
const payload = {
url: image2,
path: image,
name: fileName
name: fileNameNoExtension
};
const host = new URL(image2).host;
if (gifv || (link && combined.includes(host))) {