From 00bb39a7e42dd5a721bc5d2e526e568aac787f20 Mon Sep 17 00:00:00 2001 From: Dan <38832025+dayanch96@users.noreply.github.com> Date: Mon, 9 Dec 2024 01:06:59 +0300 Subject: [PATCH] Checks sample content type --- .github/workflows/main.yml | 9 +++++---- .github/workflows/ytp_beta.yml | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8917250..a48c330 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -75,10 +75,11 @@ jobs: - name: Validate IPA URL run: | - response=$(curl -sI "${{ inputs.ipa_url }}") - content_type=$(echo "$response" | grep -i "Content-Type" | awk '{print $2}' | tr -d '\r') - if [[ "$content_type" != "application/octet-stream" ]]; then - echo "Direct link to the IPA file required. Entered link is not a direct download or does not point to an IPA file." + curl -r 0-1023 -o sample.part "${{ inputs.ipa_url }}" > /dev/null 2>&1 + file_type=$(file --mime-type -b sample.part) + + if [[ "$file_type" != "application/x-ios-app" ]]; then + echo "ERROR: The file is not a valid IPA file. Please ensure that you have provided a direct link to the file, not a web page." exit 1 fi diff --git a/.github/workflows/ytp_beta.yml b/.github/workflows/ytp_beta.yml index 5a0ca77..0b129af 100644 --- a/.github/workflows/ytp_beta.yml +++ b/.github/workflows/ytp_beta.yml @@ -75,19 +75,21 @@ jobs: - name: Validate IPA URL run: | - response=$(curl -sI "${{ inputs.ipa_url }}") - content_type=$(echo "$response" | grep -i "Content-Type" | awk '{print $2}' | tr -d '\r') - if [[ "$content_type" != "application/octet-stream" ]]; then - echo "Direct link to the IPA file required. Entered link is not a direct download or does not point to an IPA file." + curl -r 0-1023 -o sample.part "${{ inputs.ipa_url }}" > /dev/null 2>&1 + file_type=$(file --mime-type -b sample.part) + + if [[ "$file_type" != "application/x-ios-app" ]]; then + echo "ERROR: The file is not a valid IPA file. Please ensure that you have provided a direct link to the file, not a web page." exit 1 fi - name: Validate Tweak URL run: | - response=$(curl -sI "${{ inputs.tweak_url }}") - content_type=$(echo "$response" | grep -i "Content-Type" | awk '{print $2}' | tr -d '\r') - if [[ "$content_type" != "application/octet-stream" ]]; then - echo "Direct link to the tweak file required. Entered link is not a direct download or does not point to a DEB file." + curl -r 0-1023 -o debsample.part "${{ inputs.tweak_url }}" > /dev/null 2>&1 + file_type=$(file --mime-type -b debsample.part) + + if [[ "$file_type" != "application/vnd.debian.binary-package" ]]; then + echo "ERROR: The file is not a valid DEB file. Please ensure that you have provided a direct link to the file, not a web page." exit 1 fi