File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
lib/dsc-lib/src/functions Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -70,21 +70,19 @@ impl Function for DataUriToString {
7070
7171 // Validate remaining parts: must be either "base64" or "charset=value"
7272 let mut has_base64 = false ;
73- let mut charset_count = 0 ;
74- let mut charset_value = None ;
73+ let mut charset = None ;
7574
7675 for part in & parts[ 1 ..] {
7776 if * part == "base64" {
7877 has_base64 = true ;
7978 } else if part. starts_with ( "charset=" ) {
80- charset_count += 1 ;
81- if charset_count > 1 {
79+ if charset. is_some ( ) {
8280 return Err ( DscError :: FunctionArg (
8381 "dataUriToString" . to_string ( ) ,
8482 t ! ( "functions.dataUriToString.invalidDataUri" ) . to_string ( ) ,
8583 ) ) ;
8684 }
87- charset_value = Some ( & part[ 8 ..] ) ;
85+ charset = Some ( & part[ 8 ..] ) ;
8886 } else {
8987 return Err ( DscError :: FunctionArg (
9088 "dataUriToString" . to_string ( ) ,
@@ -99,7 +97,7 @@ impl Function for DataUriToString {
9997 t ! ( "functions.dataUriToString.notBase64" ) . to_string ( ) ,
10098 ) ) ;
10199 }
102- if let Some ( charset) = charset_value {
100+ if let Some ( charset) = charset {
103101 let charset_lower = charset. to_lowercase ( ) ;
104102 if charset_lower != "utf-8" && charset_lower != "utf8" {
105103 return Err ( DscError :: FunctionArg (
You can’t perform that action at this time.
0 commit comments