Skip to content

Commit 041d203

Browse files
committed
do not use absolute URLs for images
this allows for easier reverse-proxying. existing floorplans will retain their absolute URLs unfortunately.
1 parent b9fe5fa commit 041d203

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • netbox_floorplan/static/netbox_floorplan/floorplan

netbox_floorplan/static/netbox_floorplan/floorplan/edit.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ function add_floorplan_object_simple(top, left, width, height, unit, fill,
355355
maxWidth: canvasWidth,
356356
maxHeight: canvasHeight,
357357
centeredRotation: true,
358+
srcFromAttribute: true,
358359
shadow: new fabric.Shadow({
359360
color: "red",
360361
blur: 15,
@@ -1009,7 +1010,7 @@ function update_background() {
10091010
if (floorplan.assigned_image.external_url != "") {
10101011
img_url = floorplan.assigned_image.external_url;
10111012
} else {
1012-
img_url = floorplan.assigned_image.file;
1013+
img_url = (new URL(floorplan.assigned_image.file)).pathname;
10131014
}
10141015

10151016
var img = fabric.Image.fromURL(img_url, function(img) {
@@ -1052,7 +1053,7 @@ function update_background() {
10521053
originY: 'middle'
10531054
});
10541055
}
1055-
});
1056+
}, {srcFromAttribute: true});
10561057

10571058
} else {
10581059
canvas.setBackgroundImage().renderAll();

0 commit comments

Comments
 (0)