Update app.py
Browse files
app.py
CHANGED
|
@@ -66,11 +66,11 @@ app = FastAPI(
|
|
| 66 |
)
|
| 67 |
|
| 68 |
|
|
|
|
| 69 |
# Create downloads directory if it doesn't exist
|
| 70 |
DOWNLOADS_DIR = "downloads"
|
| 71 |
os.makedirs(DOWNLOADS_DIR, exist_ok=True)
|
| 72 |
|
| 73 |
-
|
| 74 |
# Mount the downloads directory with cache control headers
|
| 75 |
class CacheControlStaticFiles(StaticFiles):
|
| 76 |
def __init__(self, directory: str):
|
|
@@ -147,10 +147,6 @@ async def download_file(request: DownloadRequest):
|
|
| 147 |
|
| 148 |
# Get the file size
|
| 149 |
file_size = os.path.getsize(downloaded_file)
|
| 150 |
-
|
| 151 |
-
# Check for encryption or corruption issues
|
| 152 |
-
if process.stderr:
|
| 153 |
-
raise Exception(f"Error in downloaded file: {process.stderr}")
|
| 154 |
|
| 155 |
# Generate the download URL and URL encode the filename
|
| 156 |
space_url = os.getenv("SPACE_URL", "https://tecuts-vob.hf.space")
|
|
|
|
| 66 |
)
|
| 67 |
|
| 68 |
|
| 69 |
+
|
| 70 |
# Create downloads directory if it doesn't exist
|
| 71 |
DOWNLOADS_DIR = "downloads"
|
| 72 |
os.makedirs(DOWNLOADS_DIR, exist_ok=True)
|
| 73 |
|
|
|
|
| 74 |
# Mount the downloads directory with cache control headers
|
| 75 |
class CacheControlStaticFiles(StaticFiles):
|
| 76 |
def __init__(self, directory: str):
|
|
|
|
| 147 |
|
| 148 |
# Get the file size
|
| 149 |
file_size = os.path.getsize(downloaded_file)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
# Generate the download URL and URL encode the filename
|
| 152 |
space_url = os.getenv("SPACE_URL", "https://tecuts-vob.hf.space")
|