finalizeSource method
Implementation
FinalizedSource finalizeSource(
String source, String? extension, String urlSuffix) {
var mutableSource = source.cldMergeSlashesInUrl();
String sourceToSign;
if (mutableSource.cldIsHttpUrl) {
mutableSource = mutableSource.cldSmartUrlEncode();
sourceToSign = mutableSource;
} else {
mutableSource = Uri.decodeComponent(mutableSource.replaceAll("+", "%2B"))
.cldSmartUrlEncode();
sourceToSign = mutableSource;
if (urlSuffix.isNotNullAndNotEmpty) {
if (urlSuffix.contains('.') || urlSuffix.contains('/')) {
throw ArgumentError('url_suffix should not include . or /');
}
mutableSource = '$mutableSource/$urlSuffix';
}
if (extension != null) {
mutableSource = '$mutableSource.$extension';
sourceToSign = '$sourceToSign.$extension';
}
}
return FinalizedSource(mutableSource, sourceToSign);
}