Use single quotes for XML attributes.

singlequotes
Martin Dosch 1 year ago
parent 58cb70c161
commit e4556759d8
No known key found for this signature in database
GPG Key ID: 52A57CFCE13D657D

@ -4,7 +4,7 @@ go 1.17
require (
github.com/ProtonMail/gopenpgp/v2 v2.7.1
github.com/beevik/etree v1.1.3
github.com/beevik/etree v1.1.4-0.20230502040559-c04c9615d8a0
github.com/gabriel-vasile/mimetype v1.4.2
github.com/mattn/go-xmpp v0.0.0-20230302152058-9129a110df1b
github.com/pborman/getopt/v2 v2.1.0

@ -7,6 +7,8 @@ github.com/ProtonMail/gopenpgp/v2 v2.7.1 h1:Awsg7MPc2gD3I7IFac2qE3Gdls0lZW8SzrFZ
github.com/ProtonMail/gopenpgp/v2 v2.7.1/go.mod h1:/BU5gfAVwqyd8EfC3Eu7zmuhwYQpKs+cGD8M//iiaxs=
github.com/beevik/etree v1.1.3 h1:RM50lzyrX4BhfIR7LI7LKq2HQtcksDWasTBnE2PaV7o=
github.com/beevik/etree v1.1.3/go.mod h1:MEjUJqV1InUci5lSfeIonCXMjsMW9yC3APDqKtnyNQg=
github.com/beevik/etree v1.1.4-0.20230502040559-c04c9615d8a0 h1:YnEGLtw0qtnKiOn39YZFgOiC4NpEPMIDG32IhB9TvME=
github.com/beevik/etree v1.1.4-0.20230502040559-c04c9615d8a0/go.mod h1:MEjUJqV1InUci5lSfeIonCXMjsMW9yC3APDqKtnyNQg=
github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/bwesterb/go-ristretto v1.2.2/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I=

@ -153,6 +153,7 @@ func httpUpload(client *xmpp.Client, iqc chan xmpp.IQ,
}
request := etree.NewDocument()
request.WriteSettings.AttrSingleQuote = true
requestReq := request.CreateElement("request")
requestReq.CreateAttr("xmlns", nsHTTPUpload)
requestReq.CreateAttr("filename", fileNameEscaped)

@ -21,6 +21,7 @@ import (
func oxDeleteNodes(jid string, client *xmpp.Client,
iqc chan xmpp.IQ) error {
nodeListRequest := etree.NewDocument()
nodeListRequest.WriteSettings.AttrSingleQuote = true
query := nodeListRequest.CreateElement("query")
query.CreateAttr("xmlns", nsDiscoItems)
nlr, err := nodeListRequest.WriteToString()
@ -231,6 +232,7 @@ func oxPublishPubKey(jid string, client *xmpp.Client, iqc chan xmpp.IQ,
}
pubKeyBase64 := base64.StdEncoding.EncodeToString(keySerialized)
root := etree.NewDocument()
root.WriteSettings.AttrSingleQuote = true
pubsub := root.CreateElement("pubsub")
pubsub.CreateAttr("xmlns", nsPubsub)
publish := pubsub.CreateElement("publish")
@ -278,6 +280,7 @@ func oxPublishPubKey(jid string, client *xmpp.Client, iqc chan xmpp.IQ,
return errors.New("couldn't successfully verify public key upload")
}
root = etree.NewDocument()
root.WriteSettings.AttrSingleQuote = true
pubsub = root.CreateElement("pubsub")
pubsub.CreateAttr("xmlns", nsPubsub)
publish = pubsub.CreateElement("publish")
@ -481,6 +484,7 @@ func oxGenPrivKey(jid string, client *xmpp.Client, iqc chan xmpp.IQ,
func oxRecvPublicKeys(client *xmpp.Client, iqc chan xmpp.IQ, recipient string,
fingerprint string) (*crypto.KeyRing, error) {
opkr := etree.NewDocument()
opkr.WriteSettings.AttrSingleQuote = true
opkrPs := opkr.CreateElement("pubsub")
opkrPs.CreateAttr("xmlns", nsPubsub)
opkrPsItems := opkrPs.CreateElement("items")
@ -555,6 +559,7 @@ func oxGetPublicKeyRing(client *xmpp.Client, iqc chan xmpp.IQ,
}
oxPubKeyListReq := etree.NewDocument()
oxPubKeyListReq.WriteSettings.AttrSingleQuote = true
oxPubKeyListReqPs := oxPubKeyListReq.CreateElement("pubsub")
oxPubKeyListReqPs.CreateAttr("xmlns", nsPubsub)
oxPubKeyListReqPsItems := oxPubKeyListReqPs.CreateElement("items")
@ -708,6 +713,7 @@ func oxEncrypt(client *xmpp.Client, iqc chan xmpp.IQ, oxPrivKey *crypto.Key,
}
}
oxCryptMessage := etree.NewDocument()
oxCryptMessage.WriteSettings.AttrSingleQuote = true
oxCryptMessageSc := oxCryptMessage.CreateElement("signcrypt")
oxCryptMessageSc.CreateAttr("xmlns", nsOx)
oxCryptMessageScTo := oxCryptMessageSc.CreateElement("to")

@ -63,6 +63,7 @@ func rcvStanzas(client *xmpp.Client, iqc chan xmpp.IQ, msgc chan xmpp.Chat) {
switch xmlns.Value {
case nsDiscoInfo:
root := etree.NewDocument()
root.WriteSettings.AttrSingleQuote = true
reply := root.CreateElement("iq")
reply.CreateAttr("type", "result")
reply.CreateAttr("from", client.JID())
@ -85,6 +86,7 @@ func rcvStanzas(client *xmpp.Client, iqc chan xmpp.IQ, msgc chan xmpp.Chat) {
}
default:
root := etree.NewDocument()
root.WriteSettings.AttrSingleQuote = true
reply := root.CreateElement("iq")
reply.CreateAttr("type", "error")
reply.CreateAttr("from", client.JID())
@ -104,6 +106,7 @@ func rcvStanzas(client *xmpp.Client, iqc chan xmpp.IQ, msgc chan xmpp.Chat) {
}
case "set":
root := etree.NewDocument()
root.WriteSettings.AttrSingleQuote = true
reply := root.CreateElement("iq")
reply.CreateAttr("type", "error")
reply.CreateAttr("from", client.JID())

Loading…
Cancel
Save