/** * Convert "foo/bar/css/" into "foo/bar/css"<br> * Convert "foo/bar/css" into "foo/bar"<br> */ protected String getTrimmedPrefix(String prefix, String delimiter) { return Str.removeSuffix(prefix, delimiter); }
public static final String remove(String s, String prefix, String suffix) { String returnValue = s; returnValue = removePrefix(returnValue, prefix); returnValue = removeSuffix(returnValue, suffix); return returnValue; }
protected boolean isDirectory(S3ObjectSummary summary, List<String> commonPrefixes, String prefix, String delimiter) { String key = summary.getKey(); if (StringUtils.equals(key, prefix)) { return true; } for (String commonPrefix : commonPrefixes) { if (StringUtils.equals(key, commonPrefix)) { return true; } String trimmedPrefix = Str.removeSuffix(commonPrefix, delimiter); if (StringUtils.equals(key, trimmedPrefix)) { return true; } } return false; }
public static PutObjectRequest getPutHtmlRequestWithoutTrailingDelimiter(BucketContext context, String cacheControl, ObjectListing listing, String html) { String delimiter = context.getDelimiter(); String objectKey = Str.removeSuffix(listing.getPrefix(), delimiter); return getPutHtmlRequest(context.getName(), cacheControl, html, objectKey); }