mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Import: UUID attribute is now validated
This commit is contained in:
parent
2a621a4367
commit
4529bcf24a
11 changed files with 23 additions and 3 deletions
14
src/Task.cpp
14
src/Task.cpp
|
@ -1404,8 +1404,18 @@ void Task::validate (bool applyDefault /* = true */)
|
|||
Task::status status = getStatus ();
|
||||
|
||||
// 1) Provide missing attributes where possible
|
||||
// Provide a UUID if necessary.
|
||||
if (! has ("uuid") || get ("uuid") == "")
|
||||
// Provide a UUID if necessary. Validate if present.
|
||||
std::string uid = get ("uuid");
|
||||
if (has ("uuid") && uid != "")
|
||||
{
|
||||
Lexer lex (uid);
|
||||
Lexer::Type type;
|
||||
if (! lex.token (uid, type) ||
|
||||
uid.length () != 36 ||
|
||||
type != Lexer::Type::uuid)
|
||||
throw format (STRING_CMD_IMPORT_UUID_BAD, uid);
|
||||
}
|
||||
else
|
||||
set ("uuid", uuid ());
|
||||
|
||||
// Recurring tasks get a special status.
|
||||
|
|
|
@ -174,8 +174,9 @@ int CmdImport::import (const std::string& input)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
void CmdImport::importSingleTask (json::object* obj)
|
||||
{
|
||||
// Parse the whole thing.
|
||||
// Parse the whole thing, validate the data.
|
||||
Task task (obj);
|
||||
task.validate ();
|
||||
|
||||
// Check whether the imported task is new or a modified existing task.
|
||||
Task before;
|
||||
|
|
|
@ -457,6 +457,7 @@
|
|||
#define STRING_CMD_IMPORT_SUMMARY "{1} Aufgabe importiert."
|
||||
#define STRING_CMD_IMPORT_FILE "Importiere '{1}'"
|
||||
#define STRING_CMD_IMPORT_MISSING "Datei '{1}' nicht gefunden."
|
||||
#define STRING_CMD_IMPORT_UUID_BAD "Not a valid UUID '{1}'."
|
||||
#define STRING_TASK_NO_DESC "Kommentar fehlt Beschreibung: {1}"
|
||||
#define STRING_TASK_NO_ENTRY "Kommentar fehlt Erfassungsdatum: {1}"
|
||||
#define STRING_CMD_SYNC_USAGE "Gleicht Daten mit dem Task-Server ab"
|
||||
|
|
|
@ -454,6 +454,7 @@
|
|||
#define STRING_CMD_IMPORT_SUMMARY "Imported {1} tasks."
|
||||
#define STRING_CMD_IMPORT_FILE "Importing '{1}'"
|
||||
#define STRING_CMD_IMPORT_MISSING "File '{1}' not found."
|
||||
#define STRING_CMD_IMPORT_UUID_BAD "Not a valid UUID '{1}'."
|
||||
#define STRING_TASK_NO_DESC "Annotation is missing a description: {1}"
|
||||
#define STRING_TASK_NO_ENTRY "Annotation is missing an entry date: {1}"
|
||||
#define STRING_CMD_SYNC_USAGE "Synchronizes data with the Taskserver"
|
||||
|
|
|
@ -457,6 +457,7 @@
|
|||
#define STRING_CMD_IMPORT_SUMMARY "Importis {1} taskojn."
|
||||
#define STRING_CMD_IMPORT_FILE "Importanta '{1}'"
|
||||
#define STRING_CMD_IMPORT_MISSING "File '{1}' not found."
|
||||
#define STRING_CMD_IMPORT_UUID_BAD "Not a valid UUID '{1}'."
|
||||
#define STRING_TASK_NO_DESC "Komento havas mankon de priskribo: {1}"
|
||||
#define STRING_TASK_NO_ENTRY "Komento havas mankon de enskrib-dato: {1}"
|
||||
#define STRING_CMD_SYNC_USAGE "Sinkronigas datumojn kun la Taskserver"
|
||||
|
|
|
@ -465,6 +465,7 @@
|
|||
#define STRING_CMD_IMPORT_SUMMARY "Importadas {1} tareas."
|
||||
#define STRING_CMD_IMPORT_FILE "Importando '{1}'"
|
||||
#define STRING_CMD_IMPORT_MISSING "Archivo '{1}' no encontrado."
|
||||
#define STRING_CMD_IMPORT_UUID_BAD "Not a valid UUID '{1}'."
|
||||
#define STRING_TASK_NO_DESC "La anotación carece de descripción: {1}"
|
||||
#define STRING_TASK_NO_ENTRY "La anotación carece de fecha de entrada: {1}"
|
||||
|
||||
|
|
|
@ -457,6 +457,7 @@
|
|||
#define STRING_CMD_IMPORT_SUMMARY "Imported {1} tasks."
|
||||
#define STRING_CMD_IMPORT_FILE "Importing '{1}'"
|
||||
#define STRING_CMD_IMPORT_MISSING "File '{1}' not found."
|
||||
#define STRING_CMD_IMPORT_UUID_BAD "Not a valid UUID '{1}'."
|
||||
#define STRING_TASK_NO_DESC "Annotation is missing a description: {1}"
|
||||
#define STRING_TASK_NO_ENTRY "Annotation is missing an entry date: {1}"
|
||||
#define STRING_CMD_SYNC_USAGE "Synchronizes data with the Taskserver"
|
||||
|
|
|
@ -456,6 +456,7 @@
|
|||
#define STRING_CMD_IMPORT_SUMMARY "Importati {1} task."
|
||||
#define STRING_CMD_IMPORT_FILE "Importazione di '{1}'"
|
||||
#define STRING_CMD_IMPORT_MISSING "File '{1}' not found."
|
||||
#define STRING_CMD_IMPORT_UUID_BAD "Not a valid UUID '{1}'."
|
||||
#define STRING_TASK_NO_DESC "Annotazione senza descrizione: {1}"
|
||||
#define STRING_TASK_NO_ENTRY "Annotazione senza data di immissione: {1}"
|
||||
#define STRING_CMD_SYNC_USAGE "Sincronizza i dati con il Taskserver"
|
||||
|
|
|
@ -457,6 +457,7 @@
|
|||
#define STRING_CMD_IMPORT_SUMMARY "{1} task をインポートしました。"
|
||||
#define STRING_CMD_IMPORT_FILE "'{1}' をインポート中"
|
||||
#define STRING_CMD_IMPORT_MISSING "ファイル '{1}' が見つかりません。"
|
||||
#define STRING_CMD_IMPORT_UUID_BAD "Not a valid UUID '{1}'."
|
||||
#define STRING_TASK_NO_DESC "Annotation is missing a description: {1}"
|
||||
#define STRING_TASK_NO_ENTRY "Annotation is missing an entry date: {1}"
|
||||
#define STRING_CMD_SYNC_USAGE "Taskserver とデータを同期"
|
||||
|
|
|
@ -457,6 +457,7 @@
|
|||
#define STRING_CMD_IMPORT_SUMMARY "Zaimportowano {1} zadań."
|
||||
#define STRING_CMD_IMPORT_FILE "Importowanie '{1}'"
|
||||
#define STRING_CMD_IMPORT_MISSING "File '{1}' not found."
|
||||
#define STRING_CMD_IMPORT_UUID_BAD "Not a valid UUID '{1}'."
|
||||
#define STRING_TASK_NO_DESC "Komentarz nie posiada treści: {1}"
|
||||
#define STRING_TASK_NO_ENTRY "Komentarz nie posiada daty utworzenia: {1}"
|
||||
#define STRING_CMD_SYNC_USAGE "Synchronizuje dane z serwerem zadań"
|
||||
|
|
|
@ -457,6 +457,7 @@
|
|||
#define STRING_CMD_IMPORT_SUMMARY "Importadas {1} tarefas."
|
||||
#define STRING_CMD_IMPORT_FILE "A importar '{1}'"
|
||||
#define STRING_CMD_IMPORT_MISSING "File '{1}' not found."
|
||||
#define STRING_CMD_IMPORT_UUID_BAD "Not a valid UUID '{1}'."
|
||||
#define STRING_TASK_NO_DESC "Descrição da anotação em falta: {1}"
|
||||
#define STRING_TASK_NO_ENTRY "Data de entrada da anotação em falta: {1}"
|
||||
#define STRING_CMD_SYNC_USAGE "Sincroniza dados com o Taskserver"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue