diff --git a/doc/man/task.1.in b/doc/man/task.1.in index ea57236bc..e81a1078d 100644 --- a/doc/man/task.1.in +++ b/doc/man/task.1.in @@ -133,7 +133,7 @@ Shows task database statistics. .TP .B import \fIfile -Imports tasks from a variety of formats. +Imports tasks in a variety of formats, from file or URL. .TP .B export diff --git a/src/import.cpp b/src/import.cpp index e3d8b07ae..ee39666f8 100644 --- a/src/import.cpp +++ b/src/import.cpp @@ -1267,16 +1267,16 @@ int handleImport (std::string& outs) if (context.hooks.trigger ("pre-import-command")) { - std::stringstream out; - + std::stringstream out; + // Use the description as a file name. std::string file = trim (context.task.get ("description")); - -#if FEATURE_URL > 0 + +#ifdef FEATURE_URL std::string tmpfile = ""; Uri uri (file); uri.parse (); - + Transport* transport; if ((transport = Transport::getTransport (uri)) != NULL ) { @@ -1288,7 +1288,7 @@ int handleImport (std::string& outs) file = tmpfile; } #endif - + if (file.length () > 0) { // Load the file. @@ -1344,11 +1344,9 @@ int handleImport (std::string& outs) case not_a_clue: /* to stop the compiler from complaining. */ break; } -#if FEATURE_URL > 0 +#ifdef FEATURE_URL if (tmpfile != "") - { remove (tmpfile.c_str ()); - } #endif } else diff --git a/test/import.url.t b/test/import.url.t index 23a871b49..709240fb9 100755 --- a/test/import.url.t +++ b/test/import.url.t @@ -38,7 +38,7 @@ if (open my $fh, '>', 'import.rc') ok (-r 'import.rc', 'Created import.rc'); } -my $output = qx{../src/task rc:import.rc import http://taskwarrior.org/attachments/download/216/import.txt}; +my $output = qx{../src/task rc:import.rc import http://tasktools.org/import.txt}; like ($output, qr/Imported 2 tasks successfully, with 0 errors./, 'no errors'); $output = qx{../src/task rc:import.rc list};