Skip to content

Commit

Permalink
Fix Tilda's bug
Browse files Browse the repository at this point in the history
  • Loading branch information
drunkbatya committed Sep 18, 2024
1 parent a83816f commit 25a9c4d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# and distributed under GNU GPL-3.0 license

import os
import requests
from flask import Flask, request, Response
from pathlib import Path

import requests
from flask import Flask, Response, request

app = Flask(__name__)

TILDA_PUBLIC_KEY = os.environ.get("TILDA_PUBLIC_KEY")
Expand Down Expand Up @@ -103,6 +104,10 @@ def extract_project(project_id):


def save_file(source_url, local_path):
if source_url.startswith(
"//"
): # Tilda's bug, some URL's can be like '//static.tildacdn.com/js/jquery-1.10.2.min.js'
source_url = "https://" + source_url.lstrip("//")
response = requests.get(source_url, stream=True)
with open(local_path, "wb") as f:
for chunk in response.iter_content(chunk_size=1024):
Expand Down

0 comments on commit 25a9c4d

Please sign in to comment.