我正在上传Word文档:
com.google.api.services.drive.model.File body = new com.google.api.services.drive.model.File();
body.setTitle(file.getName());
body.setMimeType(mimeType);
FileContent mediaContent = new FileContent(mimeType, file);
com.google.api.services.drive.model.File uploadedFile = service.files()
.insert(body, mediaContent).execute();
String downloadUrl = file.getExportLinks().get(mimeType);
Run Code Online (Sandbox Code Playgroud)
上传顺利。但是,调用 file.getExportLinks() 返回 null,因此该行是一个空指针。有谁知道为什么 getExportLinks() 返回 null?