File Corruption in SharePoint Upload via Microsoft Graph API
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
Beginne mit dem simple-upload-Zweig im bereitgestellten uploadFile-Snippet und überprüfe, wie document.contentToStream vom Aufruf des Microsoft Graph SDK 5.80.0 verwendet wird. Reproduziere den sporadisch auftretenden Fall und vergleiche dabei die Quellgröße, die hochgeladene SharePoint-Größe und den Zeitpunkt des Webhooks; abgeschlossen ist die Aufgabe, wenn eine zuverlässige Ursache identifiziert und eine verifizierte Korrektur gefunden wurde.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the bug
I am using the Microsoft Graph API 5.80.0 to upload files to SharePoint from a Java Spring Boot application. The upload works fine in normal conditions, but some files become corrupted while uploading & so unable to download from SharePoint.
Most of the upload files are smaller than 4 MB, so I am using the simple upload method (PUT request).
The upload process completes successfully (returns 200 OK with a valid file ID). When I receive the webhook for the same the file size is 0 & not able to open the file as the file is corrupted. It happens randomly for a few of the requests.
private fun uploadFile(document: DocumentUploadStream) {
val timeMillis = System.currentTimeMillis()
val buildDriveItemRequest : DriveItemRequestBuilder = microsoftGraphClient.drives("driveId").root().itemWithPath(document.path)
if (document.size < 4 * 1024 * 1024) {
// Simple upload for small files
val driveItem = retry {
refreshToken {
buildDriveItemRequest.content().buildRequest()
.put(document.contentToStream.readAllBytes())
}
}
logger.info { "Upload done ${document.path}, id: ${driveItem?.id}, time: ${(System.currentTimeMillis() - timeMillis)/1000}s" }
document.id = driveItem?.id
} else {
// Large files use upload sessions (this part is working fine)
}
}
data class DocumentUploadStream(
val path: DocumentPath,
val contentToStream: InputStream,
val size: Long
)
Expected behavior
The file should not get corrupted on upload.
Any insights or recommendations would be greatly appreciated!
Thanks
How to reproduce
With the attached snippet of code, it should be reproducible randomly.
SDK Version
5.80.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```</details>
### Configuration
_No response_
### Other information
_No response_
- Vorherrschende Sprache
- Java
- Sterne
- 444
- Forks
- 154
- Ø Merge
- 18 Std. 28 Min.
- Gemergte PRs (30 T.)
- 4
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus microsoftgraph/msgraph-sdk-java
-
status:waiting-for-triage type:bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
microsoftgraph/msgraph-sdk-java#2610 ·
-
status:waiting-for-triage type:bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
microsoftgraph/msgraph-sdk-java#2656 ·
-
status:waiting-for-triage type:bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 38/100
microsoftgraph/msgraph-sdk-java#2654 ·
-
status:waiting-for-triage
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
microsoftgraph/msgraph-sdk-java#2639 ·
-
status:waiting-for-triage type:bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
microsoftgraph/msgraph-sdk-java#2589 · 1 Kommentar ·
Alle Issues in microsoftgraph/msgraph-sdk-java
Ähnliche Issues
-
Bug Java Platform: Java
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
getsentry/sentry-java#6138 · 1 Kommentar ·
-
bug needs triage p2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
-
bug needs triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100