utils.tsx 532 B

12345678910111213141516171819
  1. import {EventAttachment} from 'sentry/types';
  2. import {Event} from 'sentry/types/event';
  3. export type ViewerProps = {
  4. attachment: EventAttachment;
  5. eventId: Event['id'];
  6. orgId: string;
  7. projectSlug: string;
  8. className?: string;
  9. };
  10. export function getAttachmentUrl(props: ViewerProps, withPrefix?: boolean): string {
  11. const {orgId, projectSlug, eventId, attachment} = props;
  12. return `${
  13. withPrefix ? '/api/0' : ''
  14. }/projects/${orgId}/${projectSlug}/events/${eventId}/attachments/${
  15. attachment.id
  16. }/?download`;
  17. }