chore: Update create-theme workflow to handle HTTPS URLs in submit-theme script

This commit is contained in:
Mauro Balades 2024-08-16 01:23:38 +02:00
parent 9adc322c37
commit 980bdc047f
2 changed files with 6 additions and 2 deletions

View file

@ -70,6 +70,7 @@ jobs:
- name: Export creation output - name: Export creation output
if: failure() if: failure()
run: | run: |
cat error.log
echo "CREATION_OUTPUT=$(cat error.log)" >> $GITHUB_ENV echo "CREATION_OUTPUT=$(cat error.log)" >> $GITHUB_ENV
- name: Show error message - name: Show error message

View file

@ -41,7 +41,10 @@ def validate_url(url, allow_empty=False):
if allow_empty and len(url) == 0: if allow_empty and len(url) == 0:
return return
try: try:
urllib.parse.urlparse(url) result = urllib.parse.urlparse(url)
if result.scheme != 'https':
print("URL must be HTTPS.", file=sys.stderr)
exit(1)
except Exception as e: except Exception as e:
print("URL is invalid.", file=sys.stderr) print("URL is invalid.", file=sys.stderr)
print(e, file=sys.stderr) print(e, file=sys.stderr)
@ -103,7 +106,7 @@ def validate_description(description):
exit(1) exit(1)
def download_image(image_url, image_path): def download_image(image_url, image_path):
response = requests.get(image_url) response = requests.get(image_url, headers={'User-Agent': 'Epicture'})
if response.status_code != 200: if response.status_code != 200:
print("Image URL is invalid.", file=sys.stderr) print("Image URL is invalid.", file=sys.stderr)
exit(1) exit(1)