FogBugz submission now MIME in 4.0.14
FogBugz submission now MIME in 4.0.14
Hi Mathias,
Installed 4.0.14 and tested this: viewtopic.php?f=4&t=28111
the new LastHttpPostReply works but the submission shows up as mime not text in FogBugz.
Tested a 4.0.13 build and all works normal so FogBugz didn't' change
thanks
Fred
Installed 4.0.14 and tested this: viewtopic.php?f=4&t=28111
the new LastHttpPostReply works but the submission shows up as mime not text in FogBugz.
Tested a 4.0.13 build and all works normal so FogBugz didn't' change
thanks
Fred
Re: FogBugz submission now MIME in 4.0.14
..more on this:
Had some time, looks like this issue is from this change:
User that is Admin will have <admin> and for email the email is in between those brackets.
Had some time, looks like this issue is from this change:
Code: Select all
Mode: Differences, Ignoring Unimportant, Just Selection
Left file: D:\VCL\madCollection\madExcept\Sources\madExcept.pas
Right file: D:\My Projects\Source\madExcept\madExcept.pas
9209 if ForceUtf8 or IsTrueUnicodeString(fields[fields.Items[i1]]) or (PosStr('<', fields[fields.Items[i1]]) > 0) then begin
<> 9192 if ForceUtf8 or IsTrueUnicodeString(fields[fields.Items[i1]]) then begin
------------------------------------------------------------------------
Re: FogBugz submission now MIME in 4.0.14
Oh well. I implemented this change for HTTP uploading and didn't remember that FogBugz runs through the same code (Mantis and BugZilla don't!). Will be properly fixed in the next build. For now you can simply undo that specific change.
Thanks for analyzing the problem!
Thanks for analyzing the problem!
Re: FogBugz submission now MIME in 4.0.14
OK, except I post to BugzScout like this:madshi wrote:Oh well. I implemented this change for HTTP uploading and didn't remember that FogBugz runs through the same code (Mantis and BugZilla don't!).
Code: Select all
fields.Add('ScoutUserName', 'AutoReporter');
fields.Add('ScoutProject', 'Inbox');
fields.Add('ScoutArea', ScoutArea);
fields.Add('Description', Subject);
fields.Add('Extra', bugReport);
fields.Add('Email', exceptIntf.MailFrom);
fields.Add('ForceNewBug', '0'); // Merge Bugz
fields.Add('ScoutDefaultMessage', 'Your ' + SubmissionText[isSupport] + ' has been submitted.');
fields.Add('FriendlyResponse', '1'); // HTML Response
{!! Will Call MAPI/MAILTO if it fails} // *Testing*=Exit(False);
result := HttpUpload('https://nastybugz.fogbugz.com/ScoutSubmit.asp', True, 0, '', '', nil, fields);
Re: FogBugz submission now MIME in 4.0.14
Ok, I see. I've been told that some HTTP servers don't like fields with "<" because such fields could contain script code. Because of that I've added that code which "encodes" strings which start with a "<" character. I suppose BugzScout does not automatically "decode" such strings? (I mean otherwise you would never have noticed the problem, I guess.)
Re: FogBugz submission now MIME in 4.0.14
All I can tell you that when I tested with ForceUtf8=TRUE the submission fails with unable to read or something like that.madshi wrote:Ok, I see. I've been told that some HTTP servers don't like fields with "<" because such fields could contain script code. Because of that I've added that code which "encodes" strings which start with a "<" character. I suppose BugzScout does not automatically "decode" such strings? (I mean otherwise you would never have noticed the problem, I guess.)
Re: FogBugz submission now MIME in 4.0.14
Well, I suppose I could add a parameter to "HttpUpload" to disable encoding of "<" fields. Would that help?
Re: FogBugz submission now MIME in 4.0.14
Don't think that's the issue.madshi wrote:Well, I suppose I could add a parameter to "HttpUpload" to disable encoding of "<" fields. Would that help?
With some more testing this works:
Code: Select all
if ForceUtf8 or IsTrueUnicodeString(fields[fields.Items[i1]]) or True {or (PosStr('<', fields[fields.Items[i1]]) > 0)} then begin
charset := 'utf-8';
encoding := '';//'base64';
as1 := {Encode}(EncodeUtf8(fields[fields.Items[i1]]));
end else begin
Re: FogBugz submission now MIME in 4.0.14
And this works as well, just encoding needed to be removed:FredS wrote: No files can be uploaded to BugzScout so decoding appears not to exist for these submissions, nor should it.
Code: Select all
if ForceUtf8 or IsTrueUnicodeString(fields[fields.Items[i1]]) or (PosStr('<', fields[fields.Items[i1]]) > 0) then begin
charset := 'utf-8';
encoding := '';//'base64';
as1 := {Encode}(EncodeUtf8(fields[fields.Items[i1]]));
Re: FogBugz submission now MIME in 4.0.14
I don't understand your syntax with "{encode}". This doesn't look like a typical Delphi language syntax to me?
Re: FogBugz submission now MIME in 4.0.14
I just commented out the Base64 Encoding for testing.madshi wrote:I don't understand your syntax with "{encode}". This doesn't look like a typical Delphi language syntax to me?
Anyhow, I have implemented my own using System.Net.HttpClient. No Base64 Encoding so all works.
Code: Select all
function DfxHttpUpload(const httpUrl: String; const fields: TStrings; HttpPostReply: PString = nil): Boolean;
var
Response: IHTTPResponse;
HttpClient: THTTPClient;
begin
HttpClient := THTTPClient.Create;
try
Response := HttpClient.Post(httpUrl, fields, nil, TEncoding.UTF8);
Result := Response.StatusCode = HTTP_STATUS_OK;
if Result.Error.SetErrMessage(Response.StatusText) then Exit;
if Assigned(HttpPostReply) then HttpPostReply^ := Response.ContentAsString(TEncoding.UTF8);
finally
HttpClient.Free;
end;
end;
Re: FogBugz submission now MIME in 4.0.14
So no need for me to change anything, anymore?
Re: FogBugz submission now MIME in 4.0.14
Correct, BugzScout submissions are most likely the only type that don't require MIME.madshi wrote:So no need for me to change anything, anymore?