xwikisas / application-googleapps

Google Apps Integration
0 stars 4 forks source link

Doc files can't be synchronized with Google Drive #73

Open ane-gabriela opened 9 months ago

ane-gabriela commented 9 months ago

Issue related to ticket 55

Preconditions: Office Server must be started.

Steps to reproduce:

  1. Login with Google owner
  2. Create a page
  3. Add an office attachment (e.g. a .doc file)
  4. Go to Attachments tab
  5. Click 'Edit in Google Apps'

Expected results: The 'Confirm Edit in Google Apps' (if the file is for the first time uploaded to Google Drive) message appears OR a message with specific details of why the document can't be edited ex. "The doc, ppt and xls formats aren't supported anymore. Use docx, pptx, xlsx formats. "

Actual results: "This document format cannot be synchronized with Google Drive."

EditDoc

NOTE: The user should get a clear message when the doc can be edited and if not, why not with details.

Environment: Windows 11, XWiki 14.10.15, Chrome 117, Google Apps Integration (Pro) 2.6

ilieandriuta commented 9 months ago

Hi! It seems I still reproduce the issue from https://github.com/xwikisas/application-googleapps/issues/55 using a .docx file (which according to the comments it should not happen). After the file is edited in Google Drive, when clicking 'Retrieve document content' button, I got:

Failed to retrieve document from Google Apps 1WyfuWoIVJHcTYiV8j919O8-gzq-ZTibTnM5-aqlc9Kg

DOCX_Error

Stacktrace from XWiki console:

GOOGLEAPPS: Retrieving NumberedList.docx to page xwiki:Pag1.WebHome: 1WyfuWoIVJHcTYiV8j919O8-gzq-ZTibTnM5-aqlc9Kg https://docs.google.com/feeds/download/documents/export/Export?id=1WyfuWoIVJHcTYiV8j919O8-gzq-ZTibTnM5-aqlc9Kg&exportFormat=docx
GOOGLEAPPS: 403 Forbidden
{
  "code" : 403,
  "errors" : [ {
    "domain" : "global",
    "location" : "alt",
    "locationType" : "parameter",
    "message" : "Only files with binary content can be downloaded. Use Export with Docs Editors files.",
    "reason" : "fileNotDownloadable"
  } ],
  "message" : "Only files with binary content can be downloaded. Use Export with Docs Editors files."
}
com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
  "code" : 403,
  "errors" : [ {
    "domain" : "global",
    "location" : "alt",
    "locationType" : "parameter",
    "message" : "Only files with binary content can be downloaded. Use Export with Docs Editors files.",
    "reason" : "fileNotDownloadable"
  } ],
  "message" : "Only files with binary content can be downloaded. Use Export with Docs Editors files."
}
        at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:146)
        at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
        at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
        at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:321)
        at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1065)
        at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
        at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
        at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeMedia(AbstractGoogleClientRequest.java:380)
        at com.google.api.services.drive.Drive$Files$Get.executeMedia(Drive.java:5765)
        at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeMediaAsInputStream(AbstractGoogleClientRequest.java:523)
        at com.google.api.services.drive.Drive$Files$Get.executeMediaAsInputStream(Drive.java:5760)
        at com.google.api.services.drive.Drive$Files$Get$executeMediaAsInputStream.call(Unknown Source)
        at GoogleAppsGroovy.retrieveFileFromGoogle(Script_765581af138cbaea069885f002925edc.groovy:580)
        at GoogleAppsGroovy$retrieveFileFromGoogle$7.callCurrent(Unknown Source)
        at GoogleAppsGroovy.retrieveFileFromGoogle(Script_765581af138cbaea069885f002925edc.groovy:569)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      [...]
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:933)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1077)
        at java.base/java.lang.Thread.run(Thread.java:833)
ane-gabriela commented 5 months ago

Reproducing on XWiki 15.10.5 with MySQL 8.3, Edge 121 and Google Apps Integration (Pro) 2.6

EditInGA

EditGA

In the XWiki console: GOOGLEAPPS: APPNAME: TestQA local wiki GOOGLEAPPS: CLIENTID: 553563769726-q2cqvun3lt6kmfdte3msm3bj5svtgnuv.apps.googleusercontent.com GOOGLEAPPS: SCOPE: [https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/userinfo.profile, https://www.googleapis.com/auth/drive] Feb 07, 2024 11:51:53 AM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly WARNING: unable to change permissions for everybody: C:\Users\Gabriela\Desktop\xwiki-platform-distribution-jetty-hsqldb-15.10.5\data\googleapps Feb 07, 2024 11:51:53 AM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly WARNING: unable to change permissions for owner: C:\Users\Gabriela\Desktop\xwiki-platform-distribution-jetty-hsqldb-15.10.5\data\googleapps GOOGLEAPPS: APPNAME: TestQA local wiki GOOGLEAPPS: CLIENTID: 553563769726-q2cqvun3lt6kmfdte3msm3bj5svtgnuv.apps.googleusercontent.com GOOGLEAPPS: SCOPE: [https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/userinfo.profile, https://www.googleapis.com/auth/drive]

ane-gabriela commented 1 month ago

Issue reproducing on Cloud XWiki 15.10.8, Google Apps Integration (Pro) 2.6.1, Chrome 125