From b19c433dfadd54427d0e5afeaaa0f223950178d5 Mon Sep 17 00:00:00 2001 From: Michael Kaiser Date: Fri, 27 Dec 2024 16:50:39 -0600 Subject: [PATCH] Fix(py/image-content-search: Swap replace with format Fixes #679 --- python/image-content-search/src/landingPage/index.html | 2 +- python/image-content-search/src/landingPage/main.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/python/image-content-search/src/landingPage/index.html b/python/image-content-search/src/landingPage/index.html index 81cac3d904..55c5e8ed9c 100644 --- a/python/image-content-search/src/landingPage/index.html +++ b/python/image-content-search/src/landingPage/index.html @@ -14,7 +14,7 @@ var idToken = authData.split('&').find((rec) => rec.split('=')[0] == 'id_token').split('=')[1] var getSignedUrlEndpoint = window.location.href.split('#')[0].replace('web', 'signedUrl') var searchImageEndpoint = window.location.href.split('#')[0].replace('web', 'search') - var loginPage = '###loginPage###'; + var loginPage = '{loginPage}'; var logoutPage = loginPage.replace('login', 'logout'); function logout() { diff --git a/python/image-content-search/src/landingPage/main.py b/python/image-content-search/src/landingPage/main.py index 4e38bb0e2e..5ebd22f23d 100644 --- a/python/image-content-search/src/landingPage/main.py +++ b/python/image-content-search/src/landingPage/main.py @@ -11,9 +11,7 @@ def handler(event, context): 'headers': { 'Content-Type': 'text/html' }, - 'body': file_get_contents("index.html").replace('###loginPage###', login_page) - } - + 'body': file_get_contents("index.html").format(loginPage=login_page) def file_get_contents(filename): with open(filename) as f: return f.read() \ No newline at end of file