ProjectDebugFile, Release, ReleaseFile, create_files_from_dif_zip, ) from sentry.tasks.assemble import ( AssembleTask, ChunkFileState, get_assemble_status, set_assemble_status, ) from sentry.utils import json logger = logging.getLogger("sentry.api") ERR_FILE_EXISTS = "A file matching this debug identifier already exists" DIF_MIMETYPES = {v: k for k, v in KNOWN_DIF_FORMATS.items()} _release_suffix = re.compile(r"^(.*)\s+\(([^)]+)\)\s*$") def upload_from_request(request, project): if "file" not in request.data: return Response({"detail": "Missing uploaded file"}, status=400) fileobj = request.data["file"] files = create_files_from_dif_zip(fileobj, project=project) return Response(serialize(files, request.user), status=201) def has_download_permission(request, project): if is_system_auth(request.auth) or is_active_superuser(request): return True
create_files_from_dif_zip, Release, ReleaseFile, ) from sentry.api.exceptions import ResourceDoesNotExist from sentry.tasks.assemble import ( get_assemble_status, set_assemble_status, AssembleTask, ChunkFileState, ) from sentry.utils import json logger = logging.getLogger("sentry.api") ERR_FILE_EXISTS = "A file matching this debug identifier already exists" DIF_MIMETYPES = dict((v, k) for k, v in KNOWN_DIF_FORMATS.items()) _release_suffix = re.compile(r"^(.*)\s+\(([^)]+)\)\s*$") def upload_from_request(request, project): if "file" not in request.data: return Response({"detail": "Missing uploaded file"}, status=400) fileobj = request.data["file"] files = create_files_from_dif_zip(fileobj, project=project) return Response(serialize(files, request.user), status=201) class DebugFilesEndpoint(ProjectEndpoint): permission_classes = (ProjectReleasePermission, ) def download(self, debug_file_id, project):
bump_reprocessing_revision from sentry.utils import metrics from sentry.utils.zip import safe_extract_zip from sentry.utils.decorators import classproperty logger = logging.getLogger(__name__) ONE_DAY = 60 * 60 * 24 ONE_DAY_AND_A_HALF = int(ONE_DAY * 1.5) # How long we cache a conversion failure by checksum in cache. Currently # 10 minutes is assumed to be a reasonable value here. CONVERSION_ERROR_TTL = 60 * 10 DIF_MIMETYPES = dict((v, k) for k, v in KNOWN_DIF_FORMATS.items()) _proguard_file_re = re.compile(r'/proguard/(?:mapping-)?(.*?)\.txt$') def _get_idempotency_id(project, checksum): """For some operations an idempotency ID is needed.""" return hashlib.sha1(b'%s|%s|project.dsym' % ( str(project.id).encode('ascii'), checksum.encode('ascii'), )).hexdigest() def get_assemble_status(project, checksum): """For a given file it checks what the current status of the assembling is. Returns a tuple in the form ``(status, details)`` where details is either