Skip to content

Commit

Permalink
fix: adjust the path length
Browse files Browse the repository at this point in the history
  • Loading branch information
cf-pages committed Sep 8, 2024
1 parent 3f2d5ce commit 86f6ed6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions functions/file/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function onRequest(context) { // Contents of context object

const url = new URL(request.url);
let fileUrl = 'https://telegra.ph/' + url.pathname + url.search
if (url.pathname.length > 30) {
if (url.pathname.length > 39) {
const formdata = new FormData();
formdata.append("file_id", url.pathname);

Expand All @@ -27,7 +27,7 @@ export async function onRequest(context) { // Contents of context object
fileUrl = `https://api.telegram.org/file/bot${env.TG_Bot_Token}/${filePath}`;

}
console.log(fileUrl)

const response = await fetch(fileUrl, {
method: request.method,
headers: request.headers,
Expand Down

0 comments on commit 86f6ed6

Please sign in to comment.