Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Q2A on Windows Server can not use "+"

+3 votes
asked Feb 12, 2017 in Q2A Core by Dr-Hack

Hello , there is alot wrong with using + in a path (not querystring) while you are using it on a windows server .. as windows on a default will block it for security purposes there are ways of enabling it for application bases by using web.config but that will open the application to vulnerabilities... although what i want to ask is can we replace the + to _  ... as this will make it bit more compatible for users running this on a windows server and as you said "nothing wrong" with an underscore.

if there is a certain element / files i need to look into let me know so i move on with it .


Note: If there is no easy way or plans to make such for near future let me know so i manually allow "+" (bad practice) on the server

1 Answer

+2 votes
answered Feb 12, 2017 by Scott
edited Mar 6, 2017 by Scott

We don't officially support Windows server but this may be solved with a plugin. I think maybe you want to replace + with %2b

You can use a function override: http://docs.question2answer.org/plugins/overrides/

Override the function qa_get_one_user_html something like:

function qa_get_one_user_html($handle, $microformats=false, $favorited=false)
    $handle = str_replace('+', '%2b', $handle);
    return qa_get_one_user_html_base($handle, $microformats, $favorited);

commented Feb 13, 2017 by Dr-Hack
yes i did add that thought you skipped it as you were on a mobile .. but even then i still get "+" in the profile links .. will be grateful if you manage to see when you get a chance.. with this fixed i will be able to roll it on production site
commented Feb 13, 2017 by Dr-Hack
for time being i just added :
            <requestFiltering allowDoubleEscaping="true" />
in the web.config so the links with + are working