From 587287b05b4d68f668d61d51ab9a3e1dd3825011 Mon Sep 17 00:00:00 2001 From: mahmoud adel <58145645+mahmoudadel54@users.noreply.github.com> Date: Mon, 11 Sep 2023 16:35:24 +0300 Subject: [PATCH] #9269 fix issue of correct map embed url in sharing map (#9395) --- web/client/components/share/SharePanel.jsx | 4 ++-- web/client/components/share/__tests__/SharePanel-test.jsx | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/web/client/components/share/SharePanel.jsx b/web/client/components/share/SharePanel.jsx index c47fceb103..962faefefa 100644 --- a/web/client/components/share/SharePanel.jsx +++ b/web/client/components/share/SharePanel.jsx @@ -106,8 +106,8 @@ class SharePanel extends React.Component { modal: false, draggable: true, onClose: () => {}, - shareUrlRegex: "(h[^#]*)#\\/viewer\\/([^\\/]*)\\/([A-Za-z0-9]*)", - shareUrlReplaceString: "$1embedded.html#/$3", + shareUrlRegex: "(h[^#]*)#\\/viewer\\/([A-Za-z0-9]*)", + shareUrlReplaceString: "$1embedded.html#/$2", embedPanel: true, embedOptions: {}, showAPI: true, diff --git a/web/client/components/share/__tests__/SharePanel-test.jsx b/web/client/components/share/__tests__/SharePanel-test.jsx index b417e8f47d..7e6b8768fb 100644 --- a/web/client/components/share/__tests__/SharePanel-test.jsx +++ b/web/client/components/share/__tests__/SharePanel-test.jsx @@ -53,7 +53,9 @@ describe("The SharePanel component", () => { const cmpSharePanel = ReactDOM.render(0} shareUrlRegex=".*" shareUrlReplaceString="ABC" shareUrl="www.geo-solutions.it" isVisible={false} />, document.getElementById("container")); expect(cmpSharePanel).toExist(); const parsed = cmpSharePanel.generateUrl("TEST", "(TE)ST", "$1"); + const embedMap = cmpSharePanel.generateUrl("http://localhost:8081/#/viewer/44asd", "(h[^#]*)#\/viewer\/([^\/]*\/[A-Za-z0-9]*|[A-Za-z0-9]*)", "$2"); expect(parsed).toBe("TE"); + expect(embedMap).toBe("44asd"); }); it('test showAPI flag', () => { let cmpSharePanel = ReactDOM.render(0} shareUrl="www.geo-solutions.it" isVisible />, document.getElementById("container"));