Favicon fix for Windows (#4369)

* favicon fix

* changelog

* svg

* remove favicon

* actual fix
This commit is contained in:
Abubakar Abid 2023-05-31 21:49:06 -07:00 committed by GitHub
parent cd64130d54
commit 31a8cfbf74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -10,6 +10,7 @@
- Make `Blocks.load` behave like other event listeners (allows chaining `then` off of it) [@anentropic](https://github.com/anentropic/) in [PR 4304](https://github.com/gradio-app/gradio/pull/4304)
- Respect `interactive=True` in output components of a `gr.Interface` by [@abidlabs](https://github.com/abidlabs) in [PR 4356](https://github.com/gradio-app/gradio/pull/4356).
- Remove unused frontend code by [@akx](https://github.com/akx) in [PR 4275](https://github.com/gradio-app/gradio/pull/4275)
- Fixes favicon path on Windows by [@abidlabs](https://github.com/abidlabs) in [PR 4369](https://github.com/gradio-app/gradio/pull/4369).
- Prevent path traversal in `/file` routes by [@abidlabs](https://github.com/abidlabs) in [PR 4370](https://github.com/gradio-app/gradio/pull/4370).
- Do not send HF token to other domains via `/proxy` route by [@abidlabs](https://github.com/abidlabs) in [PR 4368](https://github.com/gradio-app/gradio/pull/4368).

View File

@ -8,6 +8,7 @@ import inspect
import json
import mimetypes
import os
import posixpath
import secrets
import tempfile
import traceback
@ -628,7 +629,7 @@ def safe_join(directory: str, path: str) -> str:
if path == "":
raise HTTPException(400)
filename = os.path.normpath(path)
filename = posixpath.normpath(path)
fullpath = os.path.join(directory, filename)
if (
any(sep in filename for sep in _os_alt_seps)

View File

@ -56,6 +56,10 @@ class TestRoutes:
response = test_client.get("/config/")
assert response.status_code == 200
def test_favicon_route(self, test_client):
response = test_client.get("/favicon.ico")
assert response.status_code == 200
def test_upload_path(self, test_client):
with open("test/test_files/alphabet.txt") as f:
response = test_client.post("/upload", files={"files": f})