Skip to content

Commit c07d259

Browse files
committed
move feed-form issue creation to separate PR
1 parent 1be0a22 commit c07d259

File tree

1 file changed

+1
-46
lines changed

1 file changed

+1
-46
lines changed

functions/packages/feed-form/src/impl/feed-form-impl.ts

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -327,17 +327,7 @@ async function createGithubIssue(
327327
if (formData.country && formData.country in countries) {
328328
const country = countries[formData.country as TCountryCode];
329329
const continent = continents[country.continent].toLowerCase();
330-
if (continent != null) labels.push(`region/${continent}`);
331-
}
332-
333-
if (formData.authType !== "None - 0") {
334-
labels.push("auth required");
335-
}
336-
337-
if (!isValidZipUrl(formData.feedLink)) {
338-
if(!await isValidZipDownload(formData.feedLink)) {
339-
labels.push("invalid");
340-
}
330+
if (continent != null) labels.push(continent);
341331
}
342332

343333
try {
@@ -451,38 +441,3 @@ export function buildGithubIssueBody(
451441
return content;
452442
}
453443
/* eslint-enable */
454-
455-
/**
456-
* Parses the provided URL to check if it is a valid ZIP file URL
457-
* @param url The direct download URL provided in the feed form
458-
* @returns {boolean} Whether the URL is a valid ZIP file URL
459-
*/
460-
function isValidZipUrl(url: string | undefined | null): boolean {
461-
if (!url) return false;
462-
try {
463-
const parsed = new URL(url);
464-
return parsed.pathname.toLowerCase().endsWith(".zip");
465-
} catch {
466-
return false;
467-
}
468-
}
469-
470-
/**
471-
* Checks if the provided URL points to a valid ZIP file by making a HEAD request
472-
* @param url The direct download URL provided in the feed form
473-
* @returns {boolean} Whether the URL downloads a valid ZIP file
474-
*/
475-
async function isValidZipDownload(url: string | undefined | null): Promise<boolean> {
476-
try {
477-
if (!url) return false;
478-
const response = await axios.head(url, {maxRedirects: 2});
479-
const contentType = response.headers["content-type"];
480-
const contentDisposition = response.headers["content-disposition"];
481-
482-
if (contentType && contentType.includes("zip")) return true;
483-
if (contentDisposition && contentDisposition.includes("zip")) return true;
484-
return false;
485-
} catch {
486-
return false;
487-
}
488-
}

0 commit comments

Comments
 (0)