thuydao / google-api-objectivec-client

Automatically exported from code.google.com/p/google-api-objectivec-client
0 stars 0 forks source link

Upload a new file in a trashed folder in Google Drive, the new file should also have trashed attribute(but not) #70

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Get a folder's identifier when the folder is not trashed
GTLQueryDrive *queryFilesList = [GTLQueryDrive queryForFilesList];
    queryFilesList.q = [NSString stringWithFormat:@"mimeType='application/vnd.google-apps.folder' and title='%@' and 'root' in parents and trashed=false", strFolderName];

2.Remove the folder in Mac's Finder(I have installed the Google Drive client, 
So I can see Google Drive folder in Finder)

3.Upload a new file in the trashed folder with identifier which is coming from 
step 1
GTLDriveFile *file = [GTLDriveFile object];
    file.title = strUploadingName;
    file.descriptionProperty = [NSString stringWithFormat:@"Uploaded from %@", [self GetUploadFolderName]] ;
    file.mimeType = @"audio/x-caf";

    GTLDriveParentReference *parentRef = [GTLDriveParentReference object];
    parentRef.identifier = self.strFolderID; // identifier property of the folder, coming from step 1
    file.parents = @[ parentRef ];

    GTLUploadParameters *uploadParameters = [GTLUploadParameters uploadParametersWithFileHandle:fileHandle MIMEType:file.mimeType];

    GTLQueryDrive *query = [GTLQueryDrive queryForFilesInsertWithObject:file
                                                       uploadParameters:uploadParameters];

    self.uploadTicket = [self.driveService executeQuery:query
                                      completionHandler:^(GTLServiceTicket *ticket,
                                                          GTLDriveFile *insertedFile, NSError *error) {}

4.Query the new file with "trashed=false" when uploading is done. Because the 
new file is in a trashed folder, it should have trashed attribute. So the query 
result should have no item. But it actually have a new item.

GTLQueryDrive *queryFilesList = [GTLQueryDrive queryForFilesList];
    queryFilesList.q = [NSString stringWithFormat:@"title='%@' and '%@' in parents and trashed=false", strUploadingName, strFolderID];

    CLog(@"Upload upload check : %d", bCheckBeforeUpload);

    self.uploadTicket = [self.driveService executeQuery:queryFilesList completionHandler:^(GTLServiceTicket *ticket,
                                                                                           GTLDriveFileList *files,
                                                                                           NSError *error)
                         {}

What is the expected output? What do you see instead?
Query a new uploaded file in a trashed folder with 'trashed=false' should get 
no item. But I actually get the new file even 'trashed=false' is set in the 
query command.

Original issue reported on code.google.com by recorder...@gmail.com on 29 Aug 2014 at 2:33

GoogleCodeExporter commented 9 years ago
This doesn't sound like an issue/question with the Objective C support, but 
rather with the server's api itself.  You should probably try the main Drive 
support pages (https://developers.google.com/drive/support).  Including the 
HTTP logs to show the requests/responses since folks there are less likely to 
know Objective C.

Original comment by thomasvl@google.com on 29 Aug 2014 at 12:55