1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

[BUG] [Working] Unable to handle apostrophe in device name

Discussion in 'Asuswrt-Merlin' started by peepsnet, Mar 27, 2020.

  1. peepsnet

    peepsnet Regular Contributor

    Joined:
    Jul 16, 2019
    Messages:
    114
    I was just made aware that the routers firmware cannot handle an apostrophe in a device name.
    See Here and here

    I have traced it to a function call "get_folder_tree()" in /www/aidisk/getfolderarray.asp:
    where this is returned:
    Code:
    var result = [<% get_folder_tree(); %>];
    
    var result = ['WD easystore 25FB#0#1', 'SanDisk' Cruzer Fit#1#2'];
    
    Is there a way to update the code in the function: get_folder_tree()

    I searched all the files under /www but could not find the file containing the function.
    Code:
    [email protected]:/tmp/home/root# grep -rn '/www/' -e 'get_folder_tree'
    /www/aidisk/getfolderarray.asp:10:var result = [<% get_folder_tree(); %>];
    /www/aidisk/getfolderarray.asp:13:function get_folder_tree_success(){
    /www/aidisk/getfolderarray.asp:18:<body onload="get_folder_tree_success();">
    /www/getfoldertree.asp:1:<% get_folder_tree(); %>
    /www/gettree.asp:1:treeitems = [<% get_folder_tree(); %>];
    

    Is it part of the web server??
    What can we do??
     
  2. Kal-EL

    Kal-EL Very Senior Member

    Joined:
    Aug 15, 2013
    Messages:
    1,830
    Location:
    Motor City, Michigan-USA
    If it can't handle it then simply just don't use it. Why bother. :rolleyes:
     
  3. peepsnet

    peepsnet Regular Contributor

    Joined:
    Jul 16, 2019
    Messages:
    114
    Because I don't have another USB that doesn't have a '

    I can buy one or just fix it for everybody
     
  4. Kal-EL

    Kal-EL Very Senior Member

    Joined:
    Aug 15, 2013
    Messages:
    1,830
    Location:
    Motor City, Michigan-USA
    Good luck !!
     
  5. RMerlin

    RMerlin Super Moderator

    Joined:
    Apr 14, 2012
    Messages:
    33,067
    Location:
    Canada
    That's ActiveScript, meaning that's not a Javascript function, it's processed at run time by the web server.
     
  6. peepsnet

    peepsnet Regular Contributor

    Joined:
    Jul 16, 2019
    Messages:
    114
    So would that be up to Asus to work on or is the Webserver something we can touch??

    and that variable is stored in a client-side script that appears to be javascript but the www files are R/O
     
  7. RMerlin

    RMerlin Super Moderator

    Joined:
    Apr 14, 2012
    Messages:
    33,067
    Location:
    Canada
    Should be fixable, these portions of the code are usually open.

    It's not a variable, it's a tag that gets processed by the web server before being pushed to the clients. Very similar to how PHP works, for example.
     
    L&LD likes this.
  8. RMerlin

    RMerlin Super Moderator

    Joined:
    Apr 14, 2012
    Messages:
    33,067
    Location:
    Canada
    What router and firmware version are you using? I just checked the code, and it's using double quotes for elements, not single quotes.
     
  9. peepsnet

    peepsnet Regular Contributor

    Joined:
    Jul 16, 2019
    Messages:
    114
    I was just given a FW to test and it is working. I am waiting for final thoughts and testing

    RT-AC3100 384.16_beta2 at the time of OP
     
  10. john9527

    john9527 Part of the Furniture

    Joined:
    Mar 28, 2014
    Messages:
    6,292
    Location:
    United States
    Two places in httpd/web.c need to be changed from single quotes to escaped double quotes.....search for the string
    "'%s#%u#%u'"

    Let me know if you want me to send you the patch....
     
    dave14305 and peepsnet like this.
  11. peepsnet

    peepsnet Regular Contributor

    Joined:
    Jul 16, 2019
    Messages:
    114
  12. john9527

    john9527 Part of the Furniture

    Joined:
    Mar 28, 2014
    Messages:
    6,292
    Location:
    United States
    17272 and 17375 were already fixed
     
  13. peepsnet

    peepsnet Regular Contributor

    Joined:
    Jul 16, 2019
    Messages:
    114
    @Kal-EL
    It's done!!!!

    Less then 24 hours and its done!!! Never to be an issue again!!!!

    Thanks for the luck!!
     
    L&LD likes this.
  14. peepsnet

    peepsnet Regular Contributor

    Joined:
    Jul 16, 2019
    Messages:
    114
    O.I.C.
     
  15. RMerlin

    RMerlin Super Moderator

    Joined:
    Apr 14, 2012
    Messages:
    33,067
    Location:
    Canada
    I only checked the function mentioned in the first post, I didn't check for other functions being possibly broken.

    I'll fix the two other cases, thanks.
     
    L&LD likes this.
  16. john9527

    john9527 Part of the Furniture

    Joined:
    Mar 28, 2014
    Messages:
    6,292
    Location:
    United States
    Just FYI...the same code goes all the way back to my 374 fork. Figures... I just did a release today :)
     
    a5m, dave14305 and L&LD like this.