Merge remote-tracking branch 'origin/api-v1.8.2' into dev
This commit is contained in:
commit
e866e95346
5 changed files with 21 additions and 12 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from os import access, R_OK
|
||||
from os.path import exists as path_exists
|
||||
from os.path import exists as path_exists, getsize
|
||||
|
||||
import jwt
|
||||
import requests
|
||||
|
|
@ -207,9 +207,11 @@ def get_raw_mob_by_id(project_id, session_id):
|
|||
path_to_file = efs_path + "/" + __get_mob_path(project_id=project_id, session_id=session_id)
|
||||
if path_exists(path_to_file):
|
||||
if not access(path_to_file, R_OK):
|
||||
raise HTTPException(400, f"Replay file found under: {efs_path};"
|
||||
f" but it is not readable, please check permissions")
|
||||
|
||||
raise HTTPException(400, f"Replay file found under: {efs_path};" +
|
||||
f" but it is not readable, please check permissions")
|
||||
# getsize return size in bytes, UNPROCESSED_MAX_SIZE is in Kb
|
||||
if (getsize(path_to_file) / 1000) >= config("UNPROCESSED_MAX_SIZE", cast=int, default=200 * 1000):
|
||||
raise HTTPException(413, "Replay file too large")
|
||||
return path_to_file
|
||||
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ def __frame_is_valid(f):
|
|||
|
||||
def __format_frame(f):
|
||||
f["context"] = [] # no context by default
|
||||
if "source" in f: f.pop("source")
|
||||
if "source" in f:
|
||||
f.pop("source")
|
||||
url = f.pop("fileName")
|
||||
f["absPath"] = url
|
||||
f["filename"] = urlparse(url).path
|
||||
|
|
@ -74,8 +75,13 @@ def format_payload(p, truncate_to_first=False):
|
|||
|
||||
|
||||
def url_exists(url):
|
||||
r = requests.head(url, allow_redirects=False)
|
||||
return r.status_code == 200 and r.headers.get("Content-Type") != "text/html"
|
||||
try:
|
||||
r = requests.head(url, allow_redirects=False)
|
||||
return r.status_code == 200 and r.headers.get("Content-Type") != "text/html"
|
||||
except Exception as e:
|
||||
print(f"!! Issue checking if URL exists: {url}")
|
||||
print(e)
|
||||
return False
|
||||
|
||||
|
||||
def get_traces_group(project_id, payload):
|
||||
|
|
@ -97,8 +103,8 @@ def get_traces_group(project_id, payload):
|
|||
continue
|
||||
|
||||
if key not in payloads:
|
||||
file_exists_in_bucket = s3.exists(config('sourcemaps_bucket'), key)
|
||||
if not file_exists_in_bucket:
|
||||
file_exists_in_bucket = len(file_url) > 0 and s3.exists(config('sourcemaps_bucket'), key)
|
||||
if len(file_url) > 0 and not file_exists_in_bucket:
|
||||
print(f"{u['absPath']} sourcemap (key '{key}') doesn't exist in S3 looking in server")
|
||||
if not file_url.endswith(".map"):
|
||||
file_url += '.map'
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ def login(data: schemas.UserLoginSchema = Body(...)):
|
|||
|
||||
|
||||
@app.post('/{projectId}/sessions/search', tags=["sessions"])
|
||||
@app.post('/{projectId}/sessions/search2', tags=["sessions"])
|
||||
def sessions_search(projectId: int, data: schemas.FlatSessionsSearchPayloadSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions.search_sessions(data=data, project_id=projectId, user_id=context.user_id)
|
||||
|
|
@ -867,7 +868,7 @@ def delete_slack_integration(integrationId: int, context: schemas.CurrentContext
|
|||
return webhook.delete(context.tenant_id, integrationId)
|
||||
|
||||
|
||||
@app.post('/webhooks', tags=["webhooks"])
|
||||
@app.put('/webhooks', tags=["webhooks"])
|
||||
def add_edit_webhook(data: schemas.CreateEditWebhookSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": webhook.add_edit(tenant_id=context.tenant_id, data=data.dict(), replace_none=True)}
|
||||
|
|
|
|||
2
ee/api/.gitignore
vendored
2
ee/api/.gitignore
vendored
|
|
@ -248,7 +248,7 @@ Pipfile
|
|||
/routers/core.py
|
||||
/routers/crons/core_crons.py
|
||||
/db_changes.sql
|
||||
/Dockerfile.bundle
|
||||
/Dockerfile_bundle
|
||||
/entrypoint.bundle.sh
|
||||
/chalicelib/core/heatmaps.py
|
||||
/schemas.py
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ rm -rf ./routers/base.py
|
|||
rm -rf ./routers/core.py
|
||||
rm -rf ./routers/crons/core_crons.py
|
||||
rm -rf ./db_changes.sql
|
||||
rm -rf ./Dockerfile.bundle
|
||||
rm -rf ./Dockerfile_bundle
|
||||
rm -rf ./entrypoint.bundle.sh
|
||||
rm -rf ./chalicelib/core/heatmaps.py
|
||||
rm -rf ./schemas.py
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue