You are not logged in.
Pages: 1
Hi i get error Message calling mvc view with latest version.
The error seem to be in mormot.pas:
function TSQLRestServerURIContext.GetInputAsTDocVariant: variant;
i replaced the function with former one and the mvc works as expected.
the Error is that
fInput in this call has the Value 'null' and not ''
mormotmvc - line 1484
if not exec.ExecuteJson([fApplication.fFactoryEntry],pointer(fInput),WR,true) then
the null is calculated with actual version of GetInputasTDocVariant.
here the older working funktion:
function TSQLRestServerURIContext.GetInputAsTDocVariant: variant;
var ndx: integer;
v: variant;
MultiPart: TMultiPartDynArray;
begin
VarClear(result);
FillInput;
if fInput<>nil then begin
with TDocVariantData(result) do begin
InitFast;
for ndx := 0 to (length(fInput) shr 1)-1 do begin
GetVariantFromJSON(pointer(fInput[ndx*2+1]),false,v,@JSON_OPTIONS[true]);
AddValue(fInput[ndx*2],v);
end;
end;
end else
if InputAsMultiPart(MultiPart) then
with TDocVariantData(result) do begin
InitFast;
for ndx := 0 to high(MultiPart) do
with MultiPart[ndx] do
if ContentType=TEXT_CONTENT_TYPE then begin
// append as regular "Name":"TextValue" field
RawUTF8ToVariant(Content,v);
AddValue(Name,v);
end else
// append binary file as an object, with Base64-encoded data
AddValue(Name,_ObjFast(['data',BinToBase64(Content),
'filename',FileName,'contenttype',ContentType]));
end;
end;
Rad Studio 12.1 Santorini
Offline
In new function the call to res.InitFast fills Result with 'null'
Rad Studio 12.1 Santorini
Offline
Calling
exec.ExecuteJson([fApplication.fFactoryEntry],pointer(fInput),WR,true)
with fInput set to 'null' Excepts with wrong Parameter
Rad Studio 12.1 Santorini
Offline
I modfied the actual Version that it works. The Call to InitFast was executed if fInput = nil in former this was only if FInput neq nil
function TSQLRestServerURIContext.GetInputAsTDocVariant: variant;
var ndx: integer;
v: variant;
MultiPart: TMultiPartDynArray;
res: TDocVariantData absolute result;
begin
VarClear(result);
FillInput;
if fInput<>nil then begin
res.InitFast;
for ndx := 0 to (length(fInput) shr 1)-1 do begin
GetVariantFromJSON(pointer(fInput[ndx*2+1]),false,v,@JSON_OPTIONS[true]);
res.AddValue(fInput[ndx*2],v);
end
end else
if InputAsMultiPart(MultiPart) then begin
res.InitFast;
for ndx := 0 to high(MultiPart) do
with MultiPart[ndx] do
if ContentType=TEXT_CONTENT_TYPE then begin
// append as regular "Name":"TextValue" field
RawUTF8ToVariant(Content,v);
res.AddValue(Name,v);
end else
// append binary file as an object, with Base64-encoded data
res.AddValue(Name,_ObjFast(['data',BinToBase64(Content),
'filename',FileName,'contenttype',ContentType]));
end;
end;
Rad Studio 12.1 Santorini
Offline
You are right.
Should be fixed by http://synopse.info/fossil/info/8380e41113
Sorry for the regression.
Online
Pages: 1