3
0
mirror of https://github.com/Qortal/qortal.git synced 2025-02-14 11:15:49 +00:00

Applied reserved "default" keyword when publishing data too - it now maps to a blank identifier.

This commit is contained in:
CalDescent 2021-12-22 13:59:08 +00:00
parent 37e4f1e8d5
commit f85bbf12ca
3 changed files with 14 additions and 7 deletions

View File

@ -64,6 +64,11 @@ public class ArbitraryDataTransactionBuilder {
this.name = name;
this.method = method;
this.service = service;
// If identifier is a blank string, or reserved keyword "default", treat it as null
if (identifier == null || identifier.equals("") || identifier.equals("default")) {
identifier = null;
}
this.identifier = identifier;
}

View File

@ -54,9 +54,14 @@ public class ArbitraryDataWriter {
this.filePath = filePath;
this.name = name;
this.service = service;
this.identifier = identifier;
this.method = method;
this.compression = compression;
// If identifier is a blank string, or reserved keyword "default", treat it as null
if (identifier == null || identifier.equals("") || identifier.equals("default")) {
identifier = null;
}
this.identifier = identifier;
}
public void save() throws IOException, DataException, InterruptedException, MissingDataException {

View File

@ -55,11 +55,8 @@ if [[ "${method}" == "POST" ]]; then
echo "Error: missing private key. Set it by running: export QORTAL_PRIVKEY=privkeyhere"; exit
fi
# Create identifier component in URL
if [[ -z "${identifier}" || "${identifier}" == "default" ]]; then
identifier_component=""
else
identifier_component="/${identifier}"
if [ -z "${identifier}" ]; then
identifier="default"
fi
# Create type component in URL
@ -70,7 +67,7 @@ if [[ "${method}" == "POST" ]]; then
fi
echo "Creating transaction - this can take a while..."
tx_data=$(curl --silent --insecure -X ${method} "http://${host}:${port}/arbitrary/${service}/${name}${identifier_component}${type_component}" -d "${data}")
tx_data=$(curl --silent --insecure -X ${method} "http://${host}:${port}/arbitrary/${service}/${name}/${identifier}${type_component}" -d "${data}")
if [[ "${tx_data}" == *"error"* || "${tx_data}" == *"ERROR"* ]]; then
echo "${tx_data}"; exit