You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by mi...@apache.org on 2023/07/25 17:22:23 UTC

[impala] 02/03: IMPALA-12296: Fix filenames in query profile download page

This is an automated email from the ASF dual-hosted git repository.

michaelsmith pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit b7dd3c267a6e5ec092297bde853681f77c0da50c
Author: Surya Hebbar <sh...@cloudera.com>
AuthorDate: Tue Jul 18 20:49:55 2023 +0530

    IMPALA-12296: Fix filenames in query profile download page
    
    The downloads of query profiles from the profile page contain ':'
    in the filename, this is not supported by some filesystems
    such as NTFS.
    
    Most browsers replace it with a white-space during the download.
    
    Hence, characters except letters and white spaces in downloaded
    profile's filename should be replaced with '_'.
    
    Tests in 'test_web_pages.py' do not need modifications as
    the endpoint for profile downloads has not changed.
    
    Change-Id: Ia170e0ae1adc6f3347b57ca8572d65a05ebf9544
    Reviewed-on: http://gerrit.cloudera.org:8080/20215
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 www/query_profile.tmpl | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/www/query_profile.tmpl b/www/query_profile.tmpl
index 55c79fb94..2f1f194c6 100644
--- a/www/query_profile.tmpl
+++ b/www/query_profile.tmpl
@@ -27,13 +27,13 @@ under the License.
 <br/>
 <div>
     <h4>Download Profile (Available Formats):
-        <a style="font-size:16px;" class="btn btn-primary"
+        <a style="font-size:16px;" class="btn btn-primary profile-download"
             href="{{ __common__.host-url }}/query_profile_encoded?query_id={{query_id}}"
             download="thrift_profile_{{query_id}}">Thrift</a>
-        <a style="font-size:16px;" class="btn btn-primary"
+        <a style="font-size:16px;" class="btn btn-primary profile-download"
             href="{{ __common__.host-url }}/query_profile_json?query_id={{query_id}}"
             download="json_profile_{{query_id}}">Json</a>
-        <a style="font-size:16px;" class="btn btn-primary"
+        <a style="font-size:16px;" class="btn btn-primary profile-download"
             href="{{ __common__.host-url }}/query_profile_plain_text?query_id={{query_id}}"
             download="profile_{{query_id}}">Text</a>
     </h4>
@@ -43,6 +43,9 @@ under the License.
 
 <script>
 $("#profile-tab").addClass("active");
+document.querySelectorAll('.profile-download').forEach(function (profile_link) {
+  profile_link.download = profile_link.download.replace(/\W/g,'_');
+});
 </script>
 {{> www/common-footer.tmpl }}