* xmlCanonicPath: * @path: the resource locator in a filesystem notation * * Prepares a path. * * If the path contains the substring "://", it is considered a * Legacy Extended IRI. Characters which aren't allowed in URIs are * escaped. * * Otherwise, the path is considered a filesystem path which is * copied without modification. * * The caller is responsible for freeing the memory o
| 2779 | * Returns the escaped path. |
| 2780 | */ |
| 2781 | xmlChar * |
| 2782 | xmlCanonicPath(const xmlChar *path) |
| 2783 | { |
| 2784 | xmlChar *ret; |
| 2785 | |
| 2786 | if (path == NULL) |
| 2787 | return(NULL); |
| 2788 | |
| 2789 | /* Check if this is an "absolute uri" */ |
| 2790 | if (xmlStrstr(path, BAD_CAST "://") != NULL) { |
| 2791 | /* |
| 2792 | * Escape all characters except reserved, unreserved and the |
| 2793 | * percent sign. |
| 2794 | * |
| 2795 | * xmlURIEscapeStr already keeps unreserved characters, so we |
| 2796 | * pass gen-delims, sub-delims and "%" to ignore. |
| 2797 | */ |
| 2798 | ret = xmlURIEscapeStr(path, BAD_CAST ":/?#[]@!$&()*+,;='%"); |
| 2799 | } else { |
| 2800 | ret = xmlStrdup((const xmlChar *) path); |
| 2801 | } |
| 2802 | |
| 2803 | return(ret); |
| 2804 | } |
| 2805 | |
| 2806 | /** |
| 2807 | * xmlPathToURI: |
no test coverage detected