Skip to content

Commit a0f98b5

Browse files
lnt: profile queries
Upstream changed LNT a while ago to store the demangled named for C++ functions. The issue is that the demangled named contain characters that are invalid for HTTP URIs. For instance the & character. URI encode doesn't work because of this. The function can contain invalid characters for URIs. To work around this I base64 encode the function name and decode it at the other side. This enabled us to view all profile info again. Change-Id: I9386a27be8f80ff8cbc21d2ec3ea0de781f6244a
1 parent 086816c commit a0f98b5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lnt/server/ui/profile_views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from sqlalchemy.orm.exc import NoResultFound
44

55
from flask import render_template, current_app
6+
import base64
67
import os
78
import json
89
from lnt.server.ui.decorators import v4_route, frontend
@@ -108,7 +109,8 @@ def v4_profile_ajax_getCodeForFunction():
108109
ts = request.get_testsuite()
109110
runid = request.args.get('runid')
110111
testid = request.args.get('testid')
111-
f = request.args.get('f')
112+
f_enc = request.args.get('f')
113+
f = base64.b64decode(f_enc)
112114

113115
profileDir = current_app.old_config.profileDir
114116

lnt/server/ui/static/lnt_profile.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,12 +470,13 @@ Profile.prototype = {
470470
},
471471

472472
_fetch_and_display: function(fname, then) {
473-
this.function_name = fname;
473+
fname_encoded = btoa (fname)
474+
this.function_name = fname_encoded;
474475
var this_ = this;
475476
$.ajax(g_urls.getCodeForFunction, {
476477
dataType: "json",
477478
data: {'runid': this.runid, 'testid': this.testid,
478-
'f': fname},
479+
'f': fname_encoded},
479480
success: function(data) {
480481
this_.data = data;
481482
this_._display();

0 commit comments

Comments
 (0)