Selaa lähdekoodia

fix(word_extractor): Fix type error and remove stream in ssrf_proxy (#11241)

Signed-off-by: -LAN- <laipz8200@outlook.com>
tags/0.13.0
-LAN- 11 kuukautta sitten
vanhempi
commit
9601102885
No account linked to committer's email address
2 muutettua tiedostoa jossa 1 lisäystä ja 3 poistoa
  1. 0
    2
      api/core/helper/ssrf_proxy.py
  2. 1
    1
      api/core/rag/extractor/word_extractor.py

+ 0
- 2
api/core/helper/ssrf_proxy.py Näytä tiedosto

response = client.request(method=method, url=url, **kwargs) response = client.request(method=method, url=url, **kwargs)


if response.status_code not in STATUS_FORCELIST: if response.status_code not in STATUS_FORCELIST:
if stream:
return response.iter_bytes()
return response return response
else: else:
logging.warning(f"Received status code {response.status_code} for URL {url} which is in the force list") logging.warning(f"Received status code {response.status_code} for URL {url} which is in the force list")

+ 1
- 1
api/core/rag/extractor/word_extractor.py Näytä tiedosto

image_count += 1 image_count += 1
if rel.is_external: if rel.is_external:
url = rel.reltype url = rel.reltype
response = ssrf_proxy.get(url, stream=True)
response = ssrf_proxy.get(url)
if response.status_code == 200: if response.status_code == 200:
image_ext = mimetypes.guess_extension(response.headers["Content-Type"]) image_ext = mimetypes.guess_extension(response.headers["Content-Type"])
file_uuid = str(uuid.uuid4()) file_uuid = str(uuid.uuid4())

Loading…
Peruuta
Tallenna