summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Zeller <luz@plan44.ch>2011-01-28 12:03:21 +0100
committerLukas Zeller <luz@plan44.ch>2011-01-28 12:03:21 +0100
commit6ed4e2eb79ed8cff2cda78c969b6060e3256811e (patch)
tree576932dd744be0bc14a2e4028b79844ce729e3a9
parent3b6f256cde871f9b954b3a83fee71a344890168f (diff)
B64 decoding: fixed bad bug found by Patrick (thanks!) that caused B64 encoded properties not to be decoded any more. This was introduced with 3529d3cb09
- only for unprocessed properties, encodings other than QP must not be decoded. This condition was missing, so normal B64 encoded PHOTO etc. was no longer stored as decoded binary in BLOB fields as intended, but stored as-is. - improved comments regarding "unprocessed" - some whitespace cosmetics
-rw-r--r--src/global_options.h4
-rw-r--r--src/sysync/mimedirprofile.cpp28
-rwxr-xr-xsrc/sysync/mimedirprofile.h4
3 files changed, 19 insertions, 17 deletions
diff --git a/src/global_options.h b/src/global_options.h
index 2a90f18..589acfd 100644
--- a/src/global_options.h
+++ b/src/global_options.h
@@ -76,8 +76,8 @@
#endif
#ifndef SYSYNC_BUILDNUMBER
-#define SYSYNC_BUILDNUMBER 26
-#define SYSYNC_BUILDNUMBER_TXT "26"
+#define SYSYNC_BUILDNUMBER 27
+#define SYSYNC_BUILDNUMBER_TXT "27"
#endif
diff --git a/src/sysync/mimedirprofile.cpp b/src/sysync/mimedirprofile.cpp
index 773bcb1..84dc424 100644
--- a/src/sysync/mimedirprofile.cpp
+++ b/src/sysync/mimedirprofile.cpp
@@ -511,10 +511,10 @@ bool TMIMEProfileConfig::localStartElement(const char *aElementName, const char
return fail("bad boolean value");
// - add parameter
fOpenParameter = fOpenProperty->addParam(nam,defparam,positional,shownonempty,showinctcap,modeDep);
-#ifndef NO_REMOTE_RULES
+ #ifndef NO_REMOTE_RULES
const char *depRuleName = getAttr(aAttributes,"rule");
TCFG_ASSIGN(fOpenParameter->dependencyRuleName,depRuleName); // save name for later resolving
-#endif
+ #endif
startNestedParsing();
}
else if (strucmp(aElementName,"position")==0) {
@@ -941,10 +941,10 @@ TParameterDefinition::TParameterDefinition(
shownonempty=aShowNonEmpty;
showInCTCap=aShowInCTCap;
modeDependency=aModeDep;
-#ifndef NO_REMOTE_RULES
+ #ifndef NO_REMOTE_RULES
ruleDependency=NULL;
TCFG_CLEAR(dependencyRuleName);
-#endif
+ #endif
} // TParameterDefinition::TParameterDefinition
@@ -3850,9 +3850,9 @@ bool TMimeDirProfileHandler::parseProperty(
// - obtain unfolded value
val.erase();
bool dquoted = false;
- bool wasdquoted = false;
- // - note: we allow quoted params even with mimo_old, as the chance is much higher that a param value
- // beginning with doublequote is actually a quoted string than a value containing a doublequote at the beginning
+ bool wasdquoted = false;
+ // - note: we allow quoted params even with mimo_old, as the chance is much higher that a param value
+ // beginning with doublequote is actually a quoted string than a value containing a doublequote at the beginning
if (*vp=='"') {
dquoted = true;
wasdquoted = true;
@@ -3894,7 +3894,7 @@ bool TMimeDirProfileHandler::parseProperty(
// - processing of next param starts here
p=vp;
// check for global parameters
- bool storeUnprocessed = true;
+ bool storeUnprocessed = true; // in case this is a unprocessed property, flag will be cleared to prevent storing params that still ARE processed
if ((aMimeMode==mimo_old && defaultparam) || strucmp(pname.c_str(),"ENCODING")==0) {
// get encoding
// Note: always process ENCODING, as QP is mimo-old specific and must be removed for normalized storage
@@ -3903,10 +3903,12 @@ bool TMimeDirProfileHandler::parseProperty(
encoding=static_cast <TEncodingTypes> (k);
}
}
- if (encoding==enc_quoted_printable)
- storeUnprocessed = false; // QP will be decoded, so param must not be stored
- else
- encoding = enc_none; // other encodings will not be processed
+ if (aPropP->unprocessed) {
+ if (encoding==enc_quoted_printable)
+ storeUnprocessed = false; // QP will be decoded (for unprocessed properties), so param must not be stored
+ else
+ encoding = enc_none; // other encodings will not be processed for unprocessed properties
+ }
}
else if (strucmp(pname.c_str(),"CHARSET")==0) {
// charset specified (mimo_old value-only not supported)
@@ -3926,7 +3928,7 @@ bool TMimeDirProfileHandler::parseProperty(
// %%% replace 8bit chars with underscore
charset=chs_unknown;
}
- storeUnprocessed = false;
+ storeUnprocessed = false; // CHARSET is never included in unprocessed property, as we always store UTF-8
}
if (aPropP->unprocessed && storeUnprocessed && fieldoffsetfound) {
// append in reconstructed form for storing "unprocessed" (= lightly normalized)
diff --git a/src/sysync/mimedirprofile.h b/src/sysync/mimedirprofile.h
index c5845ef..e0982af 100755
--- a/src/sysync/mimedirprofile.h
+++ b/src/sysync/mimedirprofile.h
@@ -178,14 +178,14 @@ public:
bool showInCTCap;
// conversion information
TConversionDef convdef;
-#ifndef NO_REMOTE_RULES
+ #ifndef NO_REMOTE_RULES
// rule processing is simpler than with properties:
// a parameter is expanded or parsed if no rule was set or the given
// rule is active
TRemoteRuleConfig *ruleDependency;
// name of remote rule dependency (will be resolved to set ruleDependency)
TCFG_STRING dependencyRuleName;
-#endif
+ #endif
}; // TParameterDefinition