docs: public static String cleanPath(final String path) {
          final String result = path.replaceAll("//+", "/");
          return result.length() == 1 && result.charAt(0) == '/' ? result
                  : result.replaceAll("/+$", "");
      }