agave-files/files-core/src/main/java/org/iplantc/service/io/util/PathResolver.java
/**
	 * Resolve the file system path represented by the public unauthenticated
	 * file path represented by the request to the Files API.
	 * 
	 * @param owner the original owner of the path
	 * @param originalPath the original path in the http request
	 * @return true if the path is in the user's home subtree, false otherwise
	 * @throws IOException if the path is invalid
	 */
Resolve the file system path represented by the public unauthenticated
file path represented by the request to the Files API.

@param owner the original owner of the path
@param originalPath the original path in the http request
@return true if the path is in the user's home subtree, false otherwise
@throws IOException if the path is invalid
Resolve the file system path represented by the public unauthenticated file path represented by the request to the Files API . @param owner the original owner of the path @param originalPath the original path in the http request @return true if the path is in the user ' s home subtree false otherwise @throws IOException if the path is invalid
public static String resolvePublic(String owner, String originalPath) throws IOException 
	{
		String path = originalPath;
		path = path.substring(path.indexOf("files", 1));
		String[] segments = FileUtils.getPathStack(path);
		if (segments[0].equals("files") && segments[1].equals("download") &&
				segments[3].equals("system")) {
			if (segments.length == 5) {
				path = "";
			} else {
				List<String> segmentList = new ArrayList<String>();
				for(int i=5;i<segments.length; i++) {
					segmentList.add(segments[i]);
				}
				path = ServiceUtils.explode("/", segmentList);
			}
		} else {
			throw new IOException("Unrecognized URL structure for path " + path);
		}
		if (path.equals(" ")) {
			path = "/";
		} else {
			path = path.replaceAll("/ /",  "//");
		}
        Pattern regexDriveLetter = Pattern.compile("^[a-zA-Z]:");
        Pattern regexSlash = Pattern.compile("\\\\");
        path = regexDriveLetter.matcher(path).replaceAll("");
        path = regexSlash.matcher(path).replaceAll("/");
		return path; 
	}
public static String resolvePublic ( String owner , String originalPath ) throws IOException { String path = originalPath ; path = path . substring ( path . indexOf ( "files" , 1 ) ) ; String [ ] segments = FileUtils . getPathStack ( path ) ; if ( segments [ 0 ] . equals ( "files" ) && segments [ 1 ] . equals ( "download" ) && segments [ 3 ] . equals ( "system" ) ) { if ( segments . length == 5 ) { path = "" ; } else { List < String > segmentList = new ArrayList < String > ( ) ; for ( int i = 5 ; i < segments . length ; i ++ ) { segmentList . add ( segments [ i ] ) ; } path = ServiceUtils . explode ( "/" , segmentList ) ; } } else { throw new IOException ( "Unrecognized URL structure for path " + path ) ; } if ( path . equals ( " " ) ) { path = "/" ; } else { path = path . replaceAll ( "/ /" , "//" ) ; } Pattern regexDriveLetter = Pattern . compile ( "^[a-zA-Z]:" ) ; Pattern regexSlash = Pattern . compile ( "\\\\" ) ; path = regexDriveLetter . matcher ( path ) . replaceAll ( "" ) ; path = regexSlash . matcher ( path ) . replaceAll ( "/" ) ; return path ; }
Resolve the file system path represented by the public unauthenticated
 file path represented by the request to the Files API.
Resolve the file system path represented by the public unauthenticated file path represented by the request to the Files API .
// this will drop the webapp name which probably won't match the IO service route //path = path.replaceAll("//", "/ /"); // they specified the system id as the next token. drop it. // Convert Windows-format paths to sensible paths