Skip to content

Commit 22b915f

Browse files
committed
[Xml] Set totalItems if total_count missing
1 parent 12d2d6c commit 22b915f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/redmine-net-api/Serialization/Xml/XmlRedmineSerializer.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace Redmine.Net.Api.Serialization
2727
internal sealed class XmlRedmineSerializer : IRedmineSerializer
2828
{
2929

30-
public XmlRedmineSerializer(): this(new XmlWriterSettings
30+
public XmlRedmineSerializer() : this(new XmlWriterSettings
3131
{
3232
OmitXmlDeclaration = true
3333
}) { }
@@ -126,6 +126,11 @@ public string Serialize<T>(T entity) where T : class
126126
var limit = xmlReader.ReadAttributeAsInt(RedmineKeys.LIMIT);
127127
var result = xmlReader.ReadElementContentAsCollection<T>();
128128

129+
if (totalItems == 0 && result.Count > 0)
130+
{
131+
totalItems = result.Count;
132+
}
133+
129134
return new PagedResults<T>(result, totalItems, offset, limit);
130135
}
131136
}

0 commit comments

Comments
 (0)