What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

During my experiments with links to the charts I noticed that the resulting links in Data Explorer are truncated after 380 characters.

Try the following query: http://data.stackexchange.com/stackoverflow/query/58883/test-long-url

SELECT 'http://chart.apis.google.com/chart?cht=p&chco=FF0000%2CFFFF00%7CFF8000%2C00FF00%7C00FF00%2C0000FF&chs=450x200&chd=t%3A122%2C42%2C17%2C10%2C8%2C7%2C7%2C7%2C7%2C6%2C6%2C6%2C6%2C5%2C5&chl=122%7C42%7C17%7C10%7C8%7C7%7C7%7C7%7C7%7C6%7C6%7C6%7C6%7C5%7C5&chdl=android%7Cjava%7Cstack-trace%7Cbroadcastreceiver%7Candroid-ndk%7Cuser-agent%7Candroid-webview%7Cwebview%7Cbackground%7Cmultithreading%7Candroid-source%7Csms%7Cadb12345678%7Csollections%7Cactivity|Chart'

The resulting url truncates at %7Cmultithr point, also link name (Chart) is not applied.

UPDATE

After deploy the truncation is still present. I've checked the query.js source and found the following:

function encodeColumn(s) {
    if (s != null && s.replace != null) {
        s = s.replace(/[\n\r]/g, " ")
              .replace(/&(?!\w+([;\s]|$))/g, "&")
              .replace(/</g, "&lt;")
              .replace(/>/g, "&gt;")
              .substring(0, 400);
        return s;
    } else {
        return s;
    }
}

I guess that substring(0, 400) should be removed or changed to something more democratic, e.g.: substring(0, 8000).

share|improve this question
2  
And you think 380 characters is...not enough? –  jadarnel27 Jan 10 '12 at 21:03
    
@jadarnel27 Well, it may not be enough for the links to Google Charts (check the linked feature-request for details). Of course there could be some behind-the-scenes reasons for the limit… Let's wait for devs reply. –  Idolon Jan 10 '12 at 21:43
1  
Indeed, my mistake. Good catch! –  jadarnel27 Jan 10 '12 at 21:50
    
fixed and deployed –  waffles Jan 10 '12 at 22:51
    
@waffles The link from my test query is still truncated at multithr part. Check my updated post: there is substring(0, 400) in encodeColumn function. –  Idolon Jan 10 '12 at 23:30
    
@Idolon can you try again –  waffles Jan 10 '12 at 23:48
    
@waffles Ok, it's not truncated now, but & in the URL is replaced with &amp (shouldn't there be semicolon at the end?). Check it here: this should create a link to http://google.com/?hl=en&q=Test but creates to http://google.com/?hl=en&ampq=Test instead. –  Idolon Jan 11 '12 at 0:25
    
@Idolon yeah, Tim is looking into it and possibly posting a related SO question –  waffles Jan 11 '12 at 0:28
    
@waffles Thanks. It's almost 3am here so I guess I'll read Tim's question tomorrow morning ;) Just FYI: after last change it's also impossible to add | in the URL as %7C since it is replaced with %257C (vertical line symbol is used in Google Charts URLs). Updated test query accordingly. –  Idolon Jan 11 '12 at 0:54

1 Answer 1

up vote 3 down vote accepted

Yeah, the encodeColumn() function was being called a little too early on values that ended up being autolinked. I've patched the relevant code, so hopefully this will be fixed whenever waffles next gets a chance to deploy.

share|improve this answer
    
did you yank latest from main prior to patching? –  waffles Jan 10 '12 at 21:58
    
Yep, hot off the presses. Should be based off your most recent commit, as of ten or so hours ago I believe. –  Tim Stone Jan 10 '12 at 21:59
    
cool, feel free to fix any bugs you see, the data model has changed a bit. it is basically a mirror of gist. –  waffles Jan 10 '12 at 22:00
    
Will do. And yeah, I glanced over the revisions and it's much, much better now. –  Tim Stone Jan 10 '12 at 22:03
    
@TimStone As I understand the issue is substring(0, 400) at line 891 –  Idolon Jan 10 '12 at 23:22
    
@Idolon Yeah, another deploy is going out that should address this, give it a few minutes. –  Tim Stone Jan 10 '12 at 23:47
    
@TimStone Thanks for the fix - works like a charm now. –  Idolon Jan 16 '12 at 13:10
    
@Idolon Good stuff. Sorry for the delay; your specific problem was easy enough to resolve, but there was a more general issue of whether or not we should try and encode the URL for you (which caused double-encoding in your example). –  Tim Stone Jan 16 '12 at 13:17
    
@TimStone NP, I followed your progress in Mercury and was aware that encoding issue wasn't so simple to resolve. –  Idolon Jan 17 '12 at 11:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .