I'm currently using the Link module as a way to pull external links from a different website into our underdevelopment Drupal 7 site. I've created a content type that includes a link field and everything seems to be working great except the encoding on the URLs are changing once they are written to the page. The entry in the field input UI is correct and the entry in the DB are correct.

This is the link that I'm pasting into the field and this is how it shows up in the DB...
https://online.spectrumng.net/westhills/Members/PR/ProgramList.aspx?enc=Bz4fVqX+jvo9dYlB4b75Sy6gH73/mEeqYP8jekw3jTpMlWiP4+eXyfb4PM+Ap1RIc3gtH6mdyE0Bc1dS+HBs+LT2NkEuaOfligQ3P/jNZiKGfYbIyzOnWdSYFbdg45s4Ud9zQUm4+ZDi7wWeDRaGKDClbvIOK5xmTREjr93wYUyUGSRl1yOF7SFtwS3qdUl/RD043xU717S/g5/6lLQJ0L5y/fgjrq/x6/6YIHCz4FJlGDn8XT4YxiavBXozsPBXWRTmOAv808ykB8Pgv1nHmXEXxARCdXNIycDpg8nrm6OLkCwaEvuS7UF0qKr9xnyn29VvvlYr4jARuK8hshQs406WK47ai5fZpmFa71VBwn7rhYYl5/qyYIko++73nFsm7cZ3HWEvHJxX9FcELr/SVVZT8Ln3F04XGQwuVRlRJ4csTAn/mwZyGl4iApbv7bVSaw+YOAxyDcL0LSEj9brfuU0bRwRSmyQHpfqe/YkpNz8Svth81KfXTymDW1b5w7m8RwN/DS2U/wElIiI0u4qOsJztm5/VCkiUBMkVrrtDmHM=

This is how the link is displayed on screen with all the + changed to %20...
https://online.spectrumng.net/westhills/Members/PR/ProgramList.aspx?enc=Bz4fVqX%20jvo9dYlB4b75Sy6gH73/mEeqYP8jekw3jTpMlWiP4%20eXyfb4PM%20Ap1RIc3gtH6mdyE0Bc1dS%20HBs%20LT2NkEuaOfligQ3P/jNZiKGfYbIyzOnWdSYFbdg45s4Ud9zQUm4%20ZDi7wWeDRaGKDClbvIOK5xmTREjr93wYUyUGSRl1yOF7SFtwS3qdUl/RD043xU717S/g5/6lLQJ0L5y/fgjrq/x6/6YIHCz4FJlGDn8XT4YxiavBXozsPBXWRTmOAv808ykB8Pgv1nHmXEXxARCdXNIycDpg8nrm6OLkCwaEvuS7UF0qKr9xnyn29VvvlYr4jARuK8hshQs406WK47ai5fZpmFa71VBwn7rhYYl5/qyYIko%20%2073nFsm7cZ3HWEvHJxX9FcELr/SVVZT8Ln3F04XGQwuVRlRJ4csTAn/mwZyGl4iApbv7bVSaw%20YOAxyDcL0LSEj9brfuU0bRwRSmyQHpfqe/YkpNz8Svth81KfXTymDW1b5w7m8RwN/DS2U/wElIiI0u4qOsJztm5/VCkiUBMkVrrtDmHM%3D

I've tried my best to do as much reading and searching through existing issues.

I know the issue has to do with URL encoding and how the + sign is written to the page because I'm able to add +'s to the beginning part of the link up until ?enc= where the +'s turn into %20. In this case I did turn off validation just to see if +'s would show up in other parts of the URL...
https://online+.spectrumng+.net+/westhills+/Members+/PR+/ProgramList+.aspx+?enc=%20Bz4fVqX%20jvo9dYlB4b75Sy6gH73/mEeqYP8jekw3jTpMlWiP4%20eXyfb4PM%20Ap1RIc3gtH6mdyE0Bc1dS%20HBs%20LT2NkEuaOfligQ3P/jNZiKGfYbIyzOnWdSYFbdg45s4Ud9zQUm4%20ZDi7wWeDRaGKDClbvIOK5xmTREjr93wYUyUGSRl1yOF7SFtwS3qdUl/RD043xU717S/g5/6lLQJ0L5y/fgjrq/x6/6YIHCz4FJlGDn8XT4YxiavBXozsPBXWRTmOAv808ykB8Pgv1nHmXEXxARCdXNIycDpg8nrm6OLkCwaEvuS7UF0qKr9xnyn29VvvlYr4jARuK8hshQs406WK47ai5fZpmFa71VBwn7rhYYl5/qyYIko%20%2073nFsm7cZ3HWEvHJxX9FcELr/SVVZT8Ln3F04XGQwuVRlRJ4csTAn/mwZyGl4iApbv7bVSaw%20YOAxyDcL0LSEj9brfuU0bRwRSmyQHpfqe/YkpNz8Svth81KfXTymDW1b5w7m8RwN/DS2U/wElIiI0u4qOsJztm5/VCkiUBMkVrrtDmHM%3D

I assumed it had something to do with one of these functions in link.module for the preg_match...
function link_cleanup_url($url, $protocol = "http") {
function link_validate_url($text) {

I've tried just about everything to get this link to display/link correctly so any help or pointing in the right direction would be appreciated. I know it's an ugly link but I work with about 60 of these at a time and having them in a content type with the Link module would help out greatly.

Comments

garald4’s picture

Got this problem figured out by using a plain text field as my input method instead of a link field.

garald4’s picture

Status: Active » Closed (works as designed)

I'm going to close this since I figured out a workaround and the validation on link fields is definitely working as intended.