1

我不确定这是 Bugzilla 问题还是 XML-RPC 问题:使用 XML-RPC API 的 Bug.create 方法在 Bugzilla 中创建错误时,如何输入多行描述?

description 参数采用字符串值,但空格(包括换行符)似乎被去除了,我最终得到了单行描述,而不是多行文本。

以下不起作用:

<?xml version="1.0"?>
<methodCall>
    <methodName>Bug.create</methodName>
    <params>
        <param>
            <value>
                <struct>
                    <member>
                        <name>product</name>
                        <value><string>Development</string></value>
                    </member>
                    <member>
                        <name>component</name>
                        <value><string>Component01</string></value>
                    </member>
                    <member>
                        <name>summary</name>
                        <value><string>Bug created via API</string></value>
                    </member>
                    <member>
                        <name>description</name>
                        <value>
                            <string>This bug was created through the Bugzilla XML/RPC interface

Here is the second line of the description
and the third line.</string>
                        </value>
                    </member>
                    <member>
                        <name>version</name>
                        <value><string>1</string></value>
                    </member>
                    <member>
                        <name>severity</name>
                        <value><string>enhancement</string></value>
                    </member>
                    <member>
                        <name>op_sys</name>
                        <value><string>All</string></value>
                    </member>
                    <member>
                        <name>platform</name>
                        <value><string>All</string></value>
                    </member>
                    <member>
                        <name>priority</name>
                        <value><string>P5</string></value>
                    </member>
                    <member>
                        <name>assigned_to</name>
                        <value><string>example@example.com</string></value>
                    </member>
                </struct>
            </value>
        </param>
    </params>
</methodCall>

我最终得到以下描述:

This bug was created through the Bugzilla XML/RPC interfaceHere is the second line of the descriptionand the third line.
4

1 回答 1

1

我想出了一种方法:使用 base64 值而不是字符串值进行描述。

如果有人知道不同的方式,请告诉我。

这有效:

<?xml version="1.0"?>
<methodCall>
    <methodName>Bug.create</methodName>
    <params>
        <param>
            <value>
                <struct>
                    <member>
                        <name>product</name>
                        <value><string>Development</string></value>
                    </member>
                    <member>
                        <name>component</name>
                        <value><string>Component01</string></value>
                    </member>
                    <member>
                        <name>summary</name>
                        <value><string>Bug created via API</string></value>
                    </member>
                    <member>
                        <name>description</name>
                        <value>
                            <base64>VGhpcyBpcyBsaW5lIG9uZQ0KDQpibGFuayBsaW5lIGFib3ZlDQpUaGlzIGlzIHRoZSB0aGlyZCBsaW5lIG9mIHRleHQ=</base64>
                        </value>
                    </member>
                    <member>
                        <name>version</name>
                        <value><string>1</string></value>
                    </member>
                    <member>
                        <name>severity</name>
                        <value><string>enhancement</string></value>
                    </member>
                    <member>
                        <name>op_sys</name>
                        <value><string>All</string></value>
                    </member>
                    <member>
                        <name>platform</name>
                        <value><string>All</string></value>
                    </member>
                    <member>
                        <name>priority</name>
                        <value><string>P5</string></value>
                    </member>
                    <member>
                        <name>assigned_to</name>
                        <value><string>xxx@xxx.com</string></value>
                    </member>
                </struct>
            </value>
        </param>
    </params>
</methodCall>

结果:

This is line one

blank line above
This is the third line of text
于 2012-09-13T19:56:27.543 回答