Skip to content

Commit

Permalink
#18972 - Fix för: Filändelse saknas i Ladda ner-panelen
Browse files Browse the repository at this point in the history
  • Loading branch information
rafeili committed Sep 25, 2024
1 parent fa4fac1 commit 0f7b3d0
Showing 1 changed file with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
IExternalResourceData,
Utils,
IExternalImageResourceData,
Resource,
Annotation,
ManifestResource,
Rendering,
Expand All @@ -17,7 +16,6 @@ import {
Manifest,
} from "manifesto.js";
import { DownloadOption } from "../../modules/uv-shared-module/DownloadOption";
import { MediaType } from "@iiif/vocabulary";
import { CroppedImageDimensions } from "./CroppedImageDimensions";

const DownloadDialogue = ({
Expand Down Expand Up @@ -264,25 +262,17 @@ const DownloadDialogue = ({
}
}

function getCanvasImageResource(canvas: Canvas): Resource | null {
const images: Annotation[] = canvas.getImages();
if (images[0]) {
return images[0].getResource();
}
return null;
}

function getCanvasMimeType(canvas: Canvas): string | null {
const resource: Resource | null = getCanvasImageResource(canvas);

if (resource) {
const format: MediaType | null = resource.getFormat();

if (format) {
return format.toString();
const jsonld: any | null = canvas.__jsonld;

if (jsonld && jsonld.items && jsonld.items[0] && jsonld.items[0].items[0]) {
const annotation = jsonld.items[0].items[0];
const body = annotation.body;

if (body && body.format) {
return body.format;
}
}

return null;
}

Expand Down

0 comments on commit 0f7b3d0

Please sign in to comment.