After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 759180 - Can't open PDF file shared in Google Drive
Can't open PDF file shared in Google Drive
Status: RESOLVED FIXED
Product: libgdata
Classification: Platform
Component: Google Documents service
0.17.x
Other All
: Normal normal
: ---
Assigned To: libgdata-maint
libgdata-maint
Depends on:
Blocks:
 
 
Reported: 2015-12-08 15:43 UTC by Bastien Nocera
Modified: 2016-01-18 12:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
documents: Fix error handling for unknown formats for document downloads (2.71 KB, patch)
2015-12-20 19:21 UTC, Philip Withnall
committed Details | Review
documents: Split out the code to get the content type of an entry (5.27 KB, patch)
2016-01-15 17:46 UTC, Debarshi Ray
committed Details | Review
documents: Handle cases where export format is same as the original (1.71 KB, patch)
2016-01-15 17:50 UTC, Debarshi Ray
none Details | Review
documents: Split out the code to get the content type of an entry (5.28 KB, patch)
2016-01-18 10:19 UTC, Debarshi Ray
committed Details | Review
documents: Handle cases where export format is same as the original (1.95 KB, patch)
2016-01-18 10:21 UTC, Debarshi Ray
committed Details | Review

Description Bastien Nocera 2015-12-08 15:43:37 UTC
Hopefully this link works:
https://drive.google.com/folderview?id=0BxCVOQS3ZymGfmJyY2RKbE5XbVlKNlktVTlwV0lxNEdxd2dzeWZER094cmJPVnMxN1F0Yzg&ths=true&usp=docs_home&ddrp=1#

And you should be able to see a bunch of PDF files, which are specifications for touchscreen controllers.

I have those appearing in gnome-documents, but it fails to open and I get the spinner forever.

  • #0 _g_log_abort
    at gmessages.c line 324
  • #1 g_logv
    at gmessages.c line 1079
  • #2 g_log
    at gmessages.c line 1118
  • #3 g_return_if_fail_warning
    at gmessages.c line 1133
  • #4 gdata_download_stream_new
    at gdata/gdata-download-stream.c line 945
  • #5 gdata_documents_document_download
    at gdata/services/documents/gdata-documents-document.c line 395
  • #6 pdf_load_job_gdata_refresh_cache
    at lib/gd-pdf-loader.c line 412
  • #7 gdata_cache_query_info_ready_cb
    at lib/gd-pdf-loader.c line 511
  • #8 g_task_return_now
    at gtask.c line 1107
  • #9 complete_in_idle_cb
    at gtask.c line 1121
  • #10 g_main_dispatch
    at gmain.c line 3157
  • #11 g_main_context_dispatch
    at gmain.c line 3782
  • #12 g_main_context_iterate
    at gmain.c line 3853
  • #13 g_main_context_iteration
    at gmain.c line 3914
  • #14 g_application_run
    at gapplication.c line 2327
  • #15 ffi_call_unix64
    from /lib64/libffi.so.6
  • #16 ffi_call
    from /lib64/libffi.so.6
  • #17 gjs_invoke_c_function
    at gi/function.cpp line 999
  • #18 function_call
    at gi/function.cpp line 1322
  • #19 js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct)
    from /lib64/libmozjs-24.so
  • #20 Interpret(JSContext*, js::RunState&)
    from /lib64/libmozjs-24.so
  • #21 js::RunScript(JSContext*, js::RunState&)
    from /lib64/libmozjs-24.so
  • #22 js::Execute(JSContext*, JS::Handle<JSScript*>, JSObject&, JS::Value*)
    from /lib64/libmozjs-24.so
  • #23 JS::Evaluate(JSContext*, JS::Handle<JSObject*>, JS::CompileOptions, unsigned short const*, unsigned long, JS::Value*)
    from /lib64/libmozjs-24.so
  • #24 JS::Evaluate(JSContext*, JS::Handle<JSObject*>, JS::CompileOptions, char const*, unsigned long, JS::Value*)
    from /lib64/libmozjs-24.so
  • #25 gjs_eval_with_scope
    at gjs/jsapi-util.cpp line 1325
  • #26 gjs_context_eval
    at gjs/context.cpp line 645
  • #27 main
    at gjs/console.cpp line 146
  • #4 gdata_download_stream_new
    at gdata/gdata-download-stream.c line 945
  • #5 gdata_documents_document_download
    at gdata/services/documents/gdata-documents-document.c line 395
$1 = (gchar *) 0x0
(gdb) list
390			return NULL;
391		}
392	
393		/* Get the download URI and create a stream for it */
394		download_uri = gdata_documents_document_get_download_uri (self, export_format);
395		download_stream = GDATA_DOWNLOAD_STREAM (gdata_download_stream_new (GDATA_SERVICE (service), domain, download_uri, cancellable));
396		g_free (download_uri);
397	
398		return download_stream;
399	}
Comment 1 Bastien Nocera 2015-12-08 15:46:04 UTC
That looks to me like a bug in libgdata, which shouldn't call gdata_download_stream_new() when the download_uri is NULL, and should return an error at the very least.

libgdata-0.17.3-1.fc23.x86_64
Comment 2 Debarshi Ray 2015-12-08 16:00:36 UTC
Yes, this is a bug in libgdata that I introduced during the port to Drive v2 API (bug 684920).
Comment 3 Philip Withnall 2015-12-20 19:21:28 UTC
Created attachment 317699 [details] [review]
documents: Fix error handling for unknown formats for document downloads

TODO: Need to add unit tests and work out why the ‘pdf’ format is not
working for Bastien’s specific case.

---

This is a work in progress patch which fixes the crash but not (yet) the underlying problem, or adds any test cases.
Comment 4 Bastien Nocera 2015-12-21 22:18:14 UTC
Let me know what information you need to be able to debug this.
Comment 5 Debarshi Ray 2016-01-15 17:12:53 UTC
Review of attachment 317699 [details] [review]:

I totally forgot about this patch from you, and wrote the exact same thing. :)

The issue here is that we use the exportLinks from JSON to do the format conversion during download. Unfortunately, if you specify "pdf" as the export_format for something that is already a PDF, there won't be any hits in exportLinks and it would return NULL. We could add more logic to gdata_documents_document_get_download_uri to fallback to gdata_entry_get_content_uri in those cases.
Comment 6 Debarshi Ray 2016-01-15 17:46:14 UTC
Created attachment 319132 [details] [review]
documents: Split out the code to get the content type of an entry
Comment 7 Philip Withnall 2016-01-15 17:47:49 UTC
Review of attachment 319132 [details] [review]:

Looks good apart from these tiny nits; feel free to commit with them fixed.

::: gdata/services/documents/gdata-documents-utils.c
@@ +69,3 @@
+ * Returns the content type of @entry, if any.
+ *
+ * Return value: content type of @entry, NULL otherwise

(nullable)

s/NULL/%NULL/
Comment 8 Debarshi Ray 2016-01-15 17:50:44 UTC
Created attachment 319135 [details] [review]
documents: Handle cases where export format is same as the original
Comment 9 Philip Withnall 2016-01-16 07:28:25 UTC
Review of attachment 319135 [details] [review]:

Could do with a comment explaining why it’s necessary (basically what you put in comment #5).
Comment 10 Debarshi Ray 2016-01-18 10:19:48 UTC
Created attachment 319244 [details] [review]
documents: Split out the code to get the content type of an entry

Pushed to master after fixing the documentation markup and annotations.
Comment 11 Debarshi Ray 2016-01-18 10:21:14 UTC
Created attachment 319245 [details] [review]
documents: Handle cases where export format is same as the original
Comment 12 Philip Withnall 2016-01-18 11:42:16 UTC
Review of attachment 319245 [details] [review]:

++
Comment 13 Debarshi Ray 2016-01-18 12:04:28 UTC
(In reply to Philip Withnall from comment #12)
> Review of attachment 319245 [details] [review] [review]:
> 
> ++

Pushed to master. While tthis particular bug should now be fixed, I think that it would be useful to have your patch too. I'll let you decide its fate. :)
Comment 14 Philip Withnall 2016-01-18 12:57:45 UTC
Attachment 317699 [details] pushed as dc9d85d - documents: Fix error handling for unknown formats for document downloads