files.com 1.1.828 → 1.1.829

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (447) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +1 -1
  4. data/_VERSION +1 -1
  5. data/doc/Files/APIConnectionError.html +1 -1
  6. data/doc/Files/APIError.html +1 -1
  7. data/doc/Files/AccountAlreadyExistsError.html +1 -1
  8. data/doc/Files/AccountLineItem.html +1 -1
  9. data/doc/Files/AccountOverdueError.html +1 -1
  10. data/doc/Files/Action.html +1 -1
  11. data/doc/Files/ActionLog.html +1 -1
  12. data/doc/Files/ActionNotificationExport.html +1 -1
  13. data/doc/Files/ActionNotificationExportResult.html +1 -1
  14. data/doc/Files/AdditionalAuthenticationRequiredError.html +1 -1
  15. data/doc/Files/AgentNode.html +1 -1
  16. data/doc/Files/AgentNodeConnection.html +1 -1
  17. data/doc/Files/AgentNodeInstance.html +1 -1
  18. data/doc/Files/AgentPushUpdate.html +1 -1
  19. data/doc/Files/AgentPushUpdateBlockedError.html +1 -1
  20. data/doc/Files/AgentUnavailableError.html +1 -1
  21. data/doc/Files/AgentUpgradeRequiredError.html +1 -1
  22. data/doc/Files/AiAssistantPersonality.html +1 -1
  23. data/doc/Files/AiTask.html +1 -1
  24. data/doc/Files/AiTaskCannotBeRunManuallyError.html +1 -1
  25. data/doc/Files/AlreadyCompletedError.html +1 -1
  26. data/doc/Files/Api.html +1 -1
  27. data/doc/Files/ApiClient/RequestLogContext.html +1 -1
  28. data/doc/Files/ApiClient/TransferSettings.html +1 -1
  29. data/doc/Files/ApiClient.html +1 -1
  30. data/doc/Files/ApiKey.html +1 -1
  31. data/doc/Files/ApiKeyIsDisabledError.html +1 -1
  32. data/doc/Files/ApiKeyIsPathRestrictedError.html +1 -1
  33. data/doc/Files/ApiKeyNotFoundError.html +1 -1
  34. data/doc/Files/ApiKeyOnlyForDesktopAppError.html +1 -1
  35. data/doc/Files/ApiKeyOnlyForFileOperationsError.html +1 -1
  36. data/doc/Files/ApiKeyOnlyForMobileAppError.html +1 -1
  37. data/doc/Files/ApiKeyOnlyForOfficeIntegrationError.html +1 -1
  38. data/doc/Files/ApiKeySessionsNotSupportedError.html +1 -1
  39. data/doc/Files/ApiRequestLog.html +1 -1
  40. data/doc/Files/App.html +1 -1
  41. data/doc/Files/As2IncomingMessage.html +1 -1
  42. data/doc/Files/As2OutgoingMessage.html +1 -1
  43. data/doc/Files/As2Partner.html +1 -1
  44. data/doc/Files/As2Station.html +1 -1
  45. data/doc/Files/AttachmentTooLargeError.html +1 -1
  46. data/doc/Files/AuthenticationError.html +1 -1
  47. data/doc/Files/AuthenticationRequiredError.html +1 -1
  48. data/doc/Files/Auto.html +1 -1
  49. data/doc/Files/Automation.html +1 -1
  50. data/doc/Files/AutomationAuthoringSchema.html +1 -1
  51. data/doc/Files/AutomationCannotBeRunManuallyError.html +1 -1
  52. data/doc/Files/AutomationExecutionNode.html +1 -1
  53. data/doc/Files/AutomationLog.html +1 -1
  54. data/doc/Files/AutomationRun.html +1 -1
  55. data/doc/Files/AutomationsUnavailableError.html +1 -1
  56. data/doc/Files/BadRequestError.html +1 -1
  57. data/doc/Files/BandwidthSnapshot.html +1 -1
  58. data/doc/Files/Behavior.html +1 -1
  59. data/doc/Files/BehaviorNotAllowedOnRemoteServerError.html +1 -1
  60. data/doc/Files/BillingInformationHiddenError.html +1 -1
  61. data/doc/Files/BillingPermissionRequiredError.html +1 -1
  62. data/doc/Files/BufferedUploadDisabledForThisDestinationError.html +1 -1
  63. data/doc/Files/Bundle.html +1 -1
  64. data/doc/Files/BundleAction.html +1 -1
  65. data/doc/Files/BundleDownload.html +1 -1
  66. data/doc/Files/BundleMaximumUsesReachedError.html +1 -1
  67. data/doc/Files/BundleNotification.html +1 -1
  68. data/doc/Files/BundleOnlyAllowsPreviewsError.html +1 -1
  69. data/doc/Files/BundleOperationRequiresSubfolderError.html +1 -1
  70. data/doc/Files/BundlePath.html +1 -1
  71. data/doc/Files/BundlePathNotFoundError.html +1 -1
  72. data/doc/Files/BundlePermissionRequiredError.html +1 -1
  73. data/doc/Files/BundleRecipient.html +1 -1
  74. data/doc/Files/BundleRegistration.html +1 -1
  75. data/doc/Files/BundleRegistrationCodeFailedError.html +1 -1
  76. data/doc/Files/BundleRegistrationNotFoundError.html +1 -1
  77. data/doc/Files/CannotAdministerHigherLevelUserError.html +1 -1
  78. data/doc/Files/CannotDownloadDirectoryError.html +1 -1
  79. data/doc/Files/CannotLoginWhileUsingKeyError.html +1 -1
  80. data/doc/Files/CantActForOtherUserError.html +1 -1
  81. data/doc/Files/CantMoveWithMultipleLocationsError.html +1 -1
  82. data/doc/Files/ChatMessage.html +1 -1
  83. data/doc/Files/ChatSession.html +1 -1
  84. data/doc/Files/ChildSiteManagementPolicy.html +1 -1
  85. data/doc/Files/Clickwrap.html +1 -1
  86. data/doc/Files/CodeNotFoundError.html +1 -1
  87. data/doc/Files/ConfigurationLockedPathError.html +1 -1
  88. data/doc/Files/ContactAdminForPasswordChangeHelpError.html +1 -1
  89. data/doc/Files/CouldNotCreateParentError.html +1 -1
  90. data/doc/Files/CustomDomain.html +1 -1
  91. data/doc/Files/DatetimeParseError.html +1 -1
  92. data/doc/Files/DesktopConfigurationProfile.html +1 -1
  93. data/doc/Files/DestinationExistsError.html +1 -1
  94. data/doc/Files/DestinationFolderLimitedError.html +1 -1
  95. data/doc/Files/DestinationParentConflictError.html +1 -1
  96. data/doc/Files/DestinationParentDoesNotExistError.html +1 -1
  97. data/doc/Files/DestinationSameError.html +1 -1
  98. data/doc/Files/DestinationSiteMismatchError.html +1 -1
  99. data/doc/Files/DirectConnectionInfo.html +1 -1
  100. data/doc/Files/DnsRecord.html +1 -1
  101. data/doc/Files/DoesNotSupportSortingError.html +1 -1
  102. data/doc/Files/DuplicateShareRecipientError.html +1 -1
  103. data/doc/Files/EmailIncomingMessage.html +1 -1
  104. data/doc/Files/EmailLog.html +1 -1
  105. data/doc/Files/Error.html +1 -1
  106. data/doc/Files/Errors.html +1 -1
  107. data/doc/Files/EventChannel.html +1 -1
  108. data/doc/Files/EventDeliveryAttempt.html +1 -1
  109. data/doc/Files/EventRecord.html +1 -1
  110. data/doc/Files/EventSubscription.html +1 -1
  111. data/doc/Files/EventTarget.html +1 -1
  112. data/doc/Files/ExavaultApiRequestLog.html +1 -1
  113. data/doc/Files/ExceededRuntimeLimitError.html +1 -1
  114. data/doc/Files/Expectation.html +1 -1
  115. data/doc/Files/ExpectationAlreadyHasOpenWindowError.html +1 -1
  116. data/doc/Files/ExpectationEvaluation.html +1 -1
  117. data/doc/Files/ExpectationIncident.html +1 -1
  118. data/doc/Files/ExpectationNotManualTriggerError.html +1 -1
  119. data/doc/Files/ExpiredPrivateKeyError.html +1 -1
  120. data/doc/Files/ExpiredPublicKeyError.html +1 -1
  121. data/doc/Files/ExportFailureError.html +1 -1
  122. data/doc/Files/ExportNotReadyError.html +1 -1
  123. data/doc/Files/ExternalEvent.html +1 -1
  124. data/doc/Files/FailedToChangePasswordError.html +1 -1
  125. data/doc/Files/File.html +1 -1
  126. data/doc/Files/FileAction.html +1 -1
  127. data/doc/Files/FileActionError.html +1 -1
  128. data/doc/Files/FileComment.html +1 -1
  129. data/doc/Files/FileCommentReaction.html +1 -1
  130. data/doc/Files/FileLockedError.html +1 -1
  131. data/doc/Files/FileMigration.html +1 -1
  132. data/doc/Files/FileMigrationLog.html +1 -1
  133. data/doc/Files/FileNotFoundError.html +1 -1
  134. data/doc/Files/FileNotUploadedError.html +1 -1
  135. data/doc/Files/FilePendingProcessingError.html +1 -1
  136. data/doc/Files/FileProcessingErrorError.html +1 -1
  137. data/doc/Files/FileTooBigToDecryptError.html +1 -1
  138. data/doc/Files/FileTooBigToEncryptError.html +1 -1
  139. data/doc/Files/FileUploadNotFoundError.html +1 -1
  140. data/doc/Files/FileUploadPart.html +1 -1
  141. data/doc/Files/FileUploadedToWrongRegionError.html +1 -1
  142. data/doc/Files/FileUtils.html +1 -1
  143. data/doc/Files/FilenameTooLongError.html +1 -1
  144. data/doc/Files/FilesAgentFailedAuthorizationError.html +1 -1
  145. data/doc/Files/FilesNativeStorageOverloadedError.html +1 -1
  146. data/doc/Files/Folder.html +1 -1
  147. data/doc/Files/FolderAdminOrBillingPermissionRequiredError.html +1 -1
  148. data/doc/Files/FolderAdminPermissionRequiredError.html +1 -1
  149. data/doc/Files/FolderLockedError.html +1 -1
  150. data/doc/Files/FolderMustNotBeAFileError.html +1 -1
  151. data/doc/Files/FolderNotEmptyError.html +1 -1
  152. data/doc/Files/FoldersNotAllowedError.html +1 -1
  153. data/doc/Files/FormField.html +1 -1
  154. data/doc/Files/FormFieldSet.html +1 -1
  155. data/doc/Files/FtpActionLog.html +1 -1
  156. data/doc/Files/FullPermissionRequiredError.html +1 -1
  157. data/doc/Files/GpgKey.html +1 -1
  158. data/doc/Files/Group.html +1 -1
  159. data/doc/Files/GroupNotFoundError.html +1 -1
  160. data/doc/Files/GroupUser.html +1 -1
  161. data/doc/Files/History.html +1 -1
  162. data/doc/Files/HistoryExport.html +1 -1
  163. data/doc/Files/HistoryExportResult.html +1 -1
  164. data/doc/Files/HistoryPermissionRequiredError.html +1 -1
  165. data/doc/Files/HistoryUnavailableError.html +1 -1
  166. data/doc/Files/HolidayCalendar.html +1 -1
  167. data/doc/Files/HolidayRegion.html +1 -1
  168. data/doc/Files/Image.html +1 -1
  169. data/doc/Files/InAppAiAssistantUnavailableError.html +1 -1
  170. data/doc/Files/InboundS3Log.html +1 -1
  171. data/doc/Files/InboxNotFoundError.html +1 -1
  172. data/doc/Files/InboxRecipient.html +1 -1
  173. data/doc/Files/InboxRegistration.html +1 -1
  174. data/doc/Files/InboxRegistrationCodeFailedError.html +1 -1
  175. data/doc/Files/InboxUpload.html +1 -1
  176. data/doc/Files/InsufficientPermissionForParamsError.html +1 -1
  177. data/doc/Files/InsufficientPermissionForSiteError.html +1 -1
  178. data/doc/Files/IntegrationCentricProfile.html +1 -1
  179. data/doc/Files/InternalGeneralErrorError.html +1 -1
  180. data/doc/Files/InvalidBodyError.html +1 -1
  181. data/doc/Files/InvalidBundleCodeError.html +1 -1
  182. data/doc/Files/InvalidCredentialsError.html +1 -1
  183. data/doc/Files/InvalidCursorError.html +1 -1
  184. data/doc/Files/InvalidCursorTypeForSortError.html +1 -1
  185. data/doc/Files/InvalidEtagsError.html +1 -1
  186. data/doc/Files/InvalidFileTypeError.html +1 -1
  187. data/doc/Files/InvalidFilenameError.html +1 -1
  188. data/doc/Files/InvalidFilterAliasCombinationError.html +1 -1
  189. data/doc/Files/InvalidFilterFieldError.html +1 -1
  190. data/doc/Files/InvalidFilterParamError.html +1 -1
  191. data/doc/Files/InvalidFilterParamFormatError.html +1 -1
  192. data/doc/Files/InvalidFilterParamValueError.html +1 -1
  193. data/doc/Files/InvalidInputEncodingError.html +1 -1
  194. data/doc/Files/InvalidInterfaceError.html +1 -1
  195. data/doc/Files/InvalidOauthError.html +1 -1
  196. data/doc/Files/InvalidOauthProviderError.html +1 -1
  197. data/doc/Files/InvalidOrExpiredCodeError.html +1 -1
  198. data/doc/Files/InvalidParameterError.html +1 -1
  199. data/doc/Files/InvalidPathError.html +1 -1
  200. data/doc/Files/InvalidPriorityColorError.html +1 -1
  201. data/doc/Files/InvalidRangeError.html +1 -1
  202. data/doc/Files/InvalidReturnToUrlError.html +1 -1
  203. data/doc/Files/InvalidSearchQueryError.html +1 -1
  204. data/doc/Files/InvalidSessionError.html +1 -1
  205. data/doc/Files/InvalidSiteError.html +1 -1
  206. data/doc/Files/InvalidSortFieldError.html +1 -1
  207. data/doc/Files/InvalidSortFilterCombinationError.html +1 -1
  208. data/doc/Files/InvalidUploadOffsetError.html +1 -1
  209. data/doc/Files/InvalidUploadPartGapError.html +1 -1
  210. data/doc/Files/InvalidUploadPartSizeError.html +1 -1
  211. data/doc/Files/InvalidUsernameOrPasswordError.html +1 -1
  212. data/doc/Files/InvalidWorkspaceIdHeaderError.html +1 -1
  213. data/doc/Files/InvalidZipFileError.html +1 -1
  214. data/doc/Files/Invoice.html +1 -1
  215. data/doc/Files/InvoiceLineItem.html +1 -1
  216. data/doc/Files/IpAddress.html +1 -1
  217. data/doc/Files/KeyLifecycleRule.html +1 -1
  218. data/doc/Files/List.html +1 -1
  219. data/doc/Files/Lock.html +1 -1
  220. data/doc/Files/LockOperationBusyError.html +1 -1
  221. data/doc/Files/LockedOutError.html +1 -1
  222. data/doc/Files/LockoutRegionMismatchError.html +1 -1
  223. data/doc/Files/MetadataCategory.html +1 -1
  224. data/doc/Files/MetadataNotSupportedOnRemotesError.html +1 -1
  225. data/doc/Files/MethodNotAllowedError.html +1 -1
  226. data/doc/Files/MigrationInProgressError.html +1 -1
  227. data/doc/Files/MissingParameterError.html +1 -1
  228. data/doc/Files/ModelSaveErrorError.html +1 -1
  229. data/doc/Files/MoverAccessDeniedError.html +1 -1
  230. data/doc/Files/MoverPackageRequiredError.html +1 -1
  231. data/doc/Files/MultipleProcessingErrorsError.html +1 -1
  232. data/doc/Files/MultipleSortParamsNotAllowedError.html +1 -1
  233. data/doc/Files/MustAuthenticateWithApiKeyError.html +1 -1
  234. data/doc/Files/NeedAdminPermissionForInboxError.html +1 -1
  235. data/doc/Files/NestedNotFoundError.html +1 -1
  236. data/doc/Files/NoAccountForSiteError.html +1 -1
  237. data/doc/Files/NoValidInputParamsError.html +1 -1
  238. data/doc/Files/NonAdminsMustQueryByFolderOrPathError.html +1 -1
  239. data/doc/Files/NotAllowedToCreateBundleError.html +1 -1
  240. data/doc/Files/NotAuthenticatedError.html +1 -1
  241. data/doc/Files/NotAuthorizedError.html +1 -1
  242. data/doc/Files/NotEnqueuableSyncError.html +1 -1
  243. data/doc/Files/NotFoundError.html +1 -1
  244. data/doc/Files/NotImplementedError.html +1 -1
  245. data/doc/Files/Notification.html +1 -1
  246. data/doc/Files/OffsetUploadNotAllowedWithMalwareScanningError.html +1 -1
  247. data/doc/Files/OneTimePasswordIncorrectError.html +1 -1
  248. data/doc/Files/OutboundConnectionLog.html +1 -1
  249. data/doc/Files/PartNumberTooLargeError.html +1 -1
  250. data/doc/Files/Partner.html +1 -1
  251. data/doc/Files/PartnerChannel.html +1 -1
  252. data/doc/Files/PartnerChannelTemplate.html +1 -1
  253. data/doc/Files/PartnerConnection.html +1 -1
  254. data/doc/Files/PartnerSite.html +1 -1
  255. data/doc/Files/PartnerSiteRequest.html +1 -1
  256. data/doc/Files/PasswordChangeNotRequiredError.html +1 -1
  257. data/doc/Files/PasswordChangeRequiredError.html +1 -1
  258. data/doc/Files/PathCannotHaveTrailingWhitespaceError.html +1 -1
  259. data/doc/Files/PathTooLongError.html +1 -1
  260. data/doc/Files/PathUtil.html +1 -1
  261. data/doc/Files/Payment.html +1 -1
  262. data/doc/Files/PaymentLineItem.html +1 -1
  263. data/doc/Files/PaymentMethodErrorError.html +1 -1
  264. data/doc/Files/PendingWorkEvent.html +1 -1
  265. data/doc/Files/Permission.html +1 -1
  266. data/doc/Files/PlanNotFoundError.html +1 -1
  267. data/doc/Files/Preview.html +1 -1
  268. data/doc/Files/PreviewOnlyPermissionCannotDownloadError.html +1 -1
  269. data/doc/Files/ProcessingFailureError.html +1 -1
  270. data/doc/Files/PublicHostingRequestLog.html +1 -1
  271. data/doc/Files/PublicIpAddress.html +1 -1
  272. data/doc/Files/PublicKey.html +1 -1
  273. data/doc/Files/RateLimitedError.html +1 -1
  274. data/doc/Files/ReadOnlySessionError.html +1 -1
  275. data/doc/Files/ReadPermissionRequiredError.html +1 -1
  276. data/doc/Files/ReauthenticationFailedError.html +1 -1
  277. data/doc/Files/ReauthenticationFailedFinalError.html +1 -1
  278. data/doc/Files/ReauthenticationNeededActionError.html +1 -1
  279. data/doc/Files/ReauthenticationNeededFieldsError.html +1 -1
  280. data/doc/Files/ReauthenticationRateLimitedError.html +1 -1
  281. data/doc/Files/RecaptchaFailedError.html +1 -1
  282. data/doc/Files/RecipientAlreadySharedError.html +1 -1
  283. data/doc/Files/RemoteBandwidthSnapshot.html +1 -1
  284. data/doc/Files/RemoteDesktopDebugLoggingDisabledError.html +1 -1
  285. data/doc/Files/RemoteEntryReadOnlyError.html +1 -1
  286. data/doc/Files/RemoteMountBackend.html +1 -1
  287. data/doc/Files/RemoteServer.html +1 -1
  288. data/doc/Files/RemoteServerConfigurationFile.html +1 -1
  289. data/doc/Files/RemoteServerCredential.html +1 -1
  290. data/doc/Files/RemoteServerErrorError.html +1 -1
  291. data/doc/Files/Request.html +1 -1
  292. data/doc/Files/RequestBodyTooLargeError.html +1 -1
  293. data/doc/Files/RequestParamsContainInvalidCharacterError.html +1 -1
  294. data/doc/Files/RequestParamsInvalidError.html +1 -1
  295. data/doc/Files/RequestParamsRequiredError.html +1 -1
  296. data/doc/Files/ResourceBelongsToParentSiteError.html +1 -1
  297. data/doc/Files/ResourceLockedError.html +1 -1
  298. data/doc/Files/Response.html +1 -1
  299. data/doc/Files/Restore.html +1 -1
  300. data/doc/Files/RootFolderBehaviorSiteAdminRequiredError.html +1 -1
  301. data/doc/Files/RootFolderBehaviorSkipSiteAdminRequiredError.html +1 -1
  302. data/doc/Files/Schedule.html +1 -1
  303. data/doc/Files/ScheduledExport.html +1 -1
  304. data/doc/Files/ScimLog.html +1 -1
  305. data/doc/Files/SearchAllOnChildPathError.html +1 -1
  306. data/doc/Files/SearchUnavailableError.html +1 -1
  307. data/doc/Files/Secret.html +1 -1
  308. data/doc/Files/SelfManagedRequiredError.html +1 -1
  309. data/doc/Files/ServiceUnavailableError.html +1 -1
  310. data/doc/Files/Session.html +1 -1
  311. data/doc/Files/SettingsChange.html +1 -1
  312. data/doc/Files/SftpActionLog.html +1 -1
  313. data/doc/Files/SftpHostKey.html +1 -1
  314. data/doc/Files/ShareGroup.html +1 -1
  315. data/doc/Files/ShareGroupMember.html +1 -1
  316. data/doc/Files/SiemHttpDestination.html +1 -1
  317. data/doc/Files/SiemHttpDestinationEvent.html +1 -1
  318. data/doc/Files/Site.html +1 -1
  319. data/doc/Files/SiteAdminOrPartnerAdminPermissionRequiredError.html +1 -1
  320. data/doc/Files/SiteAdminOrWorkspaceAdminOrFolderAdminPermissionRequiredError.html +1 -1
  321. data/doc/Files/SiteAdminOrWorkspaceAdminOrPartnerAdminOrFolderAdminPermissionRequiredError.html +1 -1
  322. data/doc/Files/SiteAdminOrWorkspaceAdminOrPartnerAdminPermissionRequiredError.html +1 -1
  323. data/doc/Files/SiteAdminOrWorkspaceAdminPermissionRequiredError.html +1 -1
  324. data/doc/Files/SiteAdminRequiredError.html +1 -1
  325. data/doc/Files/SiteConfigurationError.html +1 -1
  326. data/doc/Files/SiteDisabledError.html +1 -1
  327. data/doc/Files/SiteFilesAreImmutableError.html +1 -1
  328. data/doc/Files/SiteNotFoundError.html +1 -1
  329. data/doc/Files/SiteSubdomainRedirect.html +1 -1
  330. data/doc/Files/SiteWasRemovedError.html +1 -1
  331. data/doc/Files/SizableIO.html +1 -1
  332. data/doc/Files/Snapshot.html +1 -1
  333. data/doc/Files/SsoEvent.html +1 -1
  334. data/doc/Files/SsoStrategy.html +1 -1
  335. data/doc/Files/Status.html +1 -1
  336. data/doc/Files/Style.html +1 -1
  337. data/doc/Files/SubfolderLockedError.html +1 -1
  338. data/doc/Files/Sync.html +1 -1
  339. data/doc/Files/SyncInProgressError.html +1 -1
  340. data/doc/Files/SyncLog.html +1 -1
  341. data/doc/Files/SyncRun.html +1 -1
  342. data/doc/Files/SyncRunLiveTransfer.html +1 -1
  343. data/doc/Files/SystemProfiler.html +1 -1
  344. data/doc/Files/TooManyConcurrentLoginsError.html +1 -1
  345. data/doc/Files/TooManyConcurrentRequestsError.html +1 -1
  346. data/doc/Files/TooManyLoginAttemptsError.html +1 -1
  347. data/doc/Files/TooManyRequestsError.html +1 -1
  348. data/doc/Files/TooManySharesError.html +1 -1
  349. data/doc/Files/Transfer/Attempts.html +1 -1
  350. data/doc/Files/Transfer/BufferLimitError.html +1 -1
  351. data/doc/Files/Transfer/ByteBudget/Reservation.html +1 -1
  352. data/doc/Files/Transfer/ByteBudget.html +1 -1
  353. data/doc/Files/Transfer/CancelledError.html +1 -1
  354. data/doc/Files/Transfer/Checkpoint.html +1 -1
  355. data/doc/Files/Transfer/CheckpointError.html +1 -1
  356. data/doc/Files/Transfer/ClientTransport/ClientResponse.html +36 -36
  357. data/doc/Files/Transfer/ClientTransport/Reader.html +33 -29
  358. data/doc/Files/Transfer/ClientTransport.html +34 -34
  359. data/doc/Files/Transfer/Clock.html +1 -1
  360. data/doc/Files/Transfer/Control.html +1 -1
  361. data/doc/Files/Transfer/Controller/Attempt.html +1 -1
  362. data/doc/Files/Transfer/Controller.html +1 -1
  363. data/doc/Files/Transfer/Coordinator/Timing.html +1 -1
  364. data/doc/Files/Transfer/Coordinator.html +1 -1
  365. data/doc/Files/Transfer/DownloadCoordinator/FileSink.html +134 -60
  366. data/doc/Files/Transfer/DownloadCoordinator/IoSink.html +152 -77
  367. data/doc/Files/Transfer/DownloadCoordinator/Piece.html +37 -37
  368. data/doc/Files/Transfer/DownloadCoordinator.html +73 -60
  369. data/doc/Files/Transfer/DownloadDate.html +1 -1
  370. data/doc/Files/Transfer/FileSlots.html +1 -1
  371. data/doc/Files/Transfer/FrontendResponseError.html +1 -1
  372. data/doc/Files/Transfer/Holds.html +1 -1
  373. data/doc/Files/Transfer/HttpTransport.html +13 -12
  374. data/doc/Files/Transfer/Job.html +1 -1
  375. data/doc/Files/Transfer/Options.html +1 -1
  376. data/doc/Files/Transfer/PausedError.html +1 -1
  377. data/doc/Files/Transfer/Policy.html +1 -1
  378. data/doc/Files/Transfer/RequestPermits.html +1 -1
  379. data/doc/Files/Transfer/SourceChangedError.html +1 -1
  380. data/doc/Files/Transfer/StorageResponse.html +1 -1
  381. data/doc/Files/Transfer/StorageRetry.html +259 -102
  382. data/doc/Files/Transfer/UploadCoordinator/Grant.html +1 -1
  383. data/doc/Files/Transfer/UploadCoordinator/Part.html +1 -1
  384. data/doc/Files/Transfer/UploadCoordinator/Region.html +1 -1
  385. data/doc/Files/Transfer/UploadCoordinator/Segments.html +1 -1
  386. data/doc/Files/Transfer/UploadCoordinator/Source.html +1 -1
  387. data/doc/Files/Transfer/UploadCoordinator/StreamSource.html +1 -1
  388. data/doc/Files/Transfer/UploadCoordinator.html +1 -1
  389. data/doc/Files/Transfer/UploadPlan.html +1 -1
  390. data/doc/Files/Transfer/UrlExpired.html +1 -1
  391. data/doc/Files/Transfer/VersionChangedError.html +1 -1
  392. data/doc/Files/Transfer.html +1 -1
  393. data/doc/Files/TrialExpiredError.html +1 -1
  394. data/doc/Files/TrialLockedError.html +1 -1
  395. data/doc/Files/TwoFactorAuthenticationCodeAlreadySentError.html +1 -1
  396. data/doc/Files/TwoFactorAuthenticationCountryBlacklistedError.html +1 -1
  397. data/doc/Files/TwoFactorAuthenticationErrorError.html +1 -1
  398. data/doc/Files/TwoFactorAuthenticationGeneralErrorError.html +1 -1
  399. data/doc/Files/TwoFactorAuthenticationMethodUnsupportedErrorError.html +1 -1
  400. data/doc/Files/TwoFactorAuthenticationRequiredError.html +1 -1
  401. data/doc/Files/TwoFactorAuthenticationSetupExpiredError.html +1 -1
  402. data/doc/Files/TwoFactorAuthenticationUnsubscribedRecipientError.html +1 -1
  403. data/doc/Files/URI.html +1 -1
  404. data/doc/Files/UnrecognizedSortIndexError.html +1 -1
  405. data/doc/Files/UnsupportedCurrencyError.html +1 -1
  406. data/doc/Files/UnsupportedHttpResponseFormatError.html +1 -1
  407. data/doc/Files/UnsupportedMediaTypeError.html +1 -1
  408. data/doc/Files/UpdatesNotAllowedForRemotesError.html +1 -1
  409. data/doc/Files/UploadFinalization.html +1 -1
  410. data/doc/Files/UploadsUnavailableError.html +1 -1
  411. data/doc/Files/UsageByTopLevelDir.html +1 -1
  412. data/doc/Files/UsageDailySnapshot.html +1 -1
  413. data/doc/Files/UsageSnapshot.html +1 -1
  414. data/doc/Files/User.html +1 -1
  415. data/doc/Files/UserAdditionalEmailRecipient.html +1 -1
  416. data/doc/Files/UserCipherUse.html +1 -1
  417. data/doc/Files/UserIdInvalidError.html +1 -1
  418. data/doc/Files/UserIdOnUserEndpointError.html +1 -1
  419. data/doc/Files/UserIdWithoutSiteAdminError.html +1 -1
  420. data/doc/Files/UserLifecycleRule.html +1 -1
  421. data/doc/Files/UserNotFoundError.html +1 -1
  422. data/doc/Files/UserRequest.html +1 -1
  423. data/doc/Files/UserRequestsEnabledRequiredError.html +1 -1
  424. data/doc/Files/UserRequiredError.html +1 -1
  425. data/doc/Files/UserSecurityEvent.html +1 -1
  426. data/doc/Files/UserSftpClientUse.html +1 -1
  427. data/doc/Files/Util/LogSettings.html +1 -1
  428. data/doc/Files/Util.html +1 -1
  429. data/doc/Files/WebDavActionLog.html +1 -1
  430. data/doc/Files/WebhookTest.html +1 -1
  431. data/doc/Files/Workspace.html +1 -1
  432. data/doc/Files/WriteAndBundlePermissionRequiredError.html +1 -1
  433. data/doc/Files/WritePermissionRequiredError.html +1 -1
  434. data/doc/Files/ZipListEntry.html +1 -1
  435. data/doc/Files.html +1 -1
  436. data/doc/_index.html +1 -1
  437. data/doc/file.README.html +2 -2
  438. data/doc/index.html +2 -2
  439. data/doc/method_list.html +2985 -2953
  440. data/doc/top-level-namespace.html +1 -1
  441. data/docs/file.md +21 -5
  442. data/lib/files.com/transfer/download_coordinator.rb +93 -11
  443. data/lib/files.com/transfer/http_transport.rb +14 -9
  444. data/lib/files.com/transfer/storage_retry.rb +22 -4
  445. data/spec/models/native_file_spec.rb +4 -2
  446. data/spec/transfer/adaptive_download_spec.rb +219 -3
  447. metadata +1 -1
@@ -102,7 +102,7 @@
102
102
  </div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Fri Nov 13 23:51:24 2026 by
105
+ Generated on Sat Nov 14 22:52:22 2026 by
106
106
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
107
  0.9.45 (ruby-4.0.9).
108
108
  </div>
data/docs/file.md CHANGED
@@ -335,8 +335,22 @@ A download first asks for its opening range (8 MiB, or a quarter of
335
335
  `buffer_bytes` when that is less). Ranges are fetched at once only when
336
336
  storage answers with a strong ETag and exact `Content-Range` and
337
337
  `Content-Length`; each later range is requested with `If-Match` and must
338
- match exactly. A 412, or a whole response with another ETag, raises
339
- `Files::Transfer::VersionChangedError` before any of it is written. Ranges are
338
+ match exactly. A 412, a whole response with another ETag, a newer
339
+ `Last-Modified`, or storage's 409 whose whole JSON body, of at most 4 KiB, has
340
+ the `type` `download_source_changed`, means the remote file changed, and is
341
+ found before any of that response is written. Once the requests in flight have
342
+ settled (a range of the old version still arriving stops at its next chunk),
343
+ `download_file` then starts its file over from the first byte, with a
344
+ new download URL from the API and the size, version and date storage answers
345
+ with now, never keeping a byte or a version of the attempt before. Each such
346
+ restart is one of `Files.max_network_retries`, counted for the whole download,
347
+ apart from each request's own retries, however far it got, so a file that
348
+ keeps changing fails; with 0 there is none. An IO
349
+ you passed to `download_content` starts over only while nothing has been
350
+ written to it. A cancellation or pause that came first is raised instead.
351
+ Otherwise, and once the restarts are spent,
352
+ `Files::Transfer::VersionChangedError` is raised. Any other 409 is refused as
353
+ before. Ranges are
340
354
  written in order, and those waiting for an earlier one count against
341
355
  `buffer_bytes`. A download looks up its URL, and renews it, with the API
342
356
  options, credential, origin, workspace and settings it began with, from the
@@ -452,9 +466,11 @@ from a local file, a StringIO, or an IO you passed that can give them back
452
466
  Tempfile; an IO that cannot is refused. Anything after them is dropped only
453
467
  once storage's answer proves the version: as the first new bytes are written,
454
468
  or, when every byte was written before the pause, once storage answers for
455
- the file's last byte with that version. A download stops with
456
- `VersionChangedError` when storage no longer has its version, leaving the
457
- destination as it was, and an upload stops when a renewed part's instructions
469
+ the file's last byte with that version. When storage no longer has its
470
+ version, a download into a local file starts it over within
471
+ `Files.max_network_retries`, as any download does when the remote file
472
+ changes; a download into an IO, or one with no retries, stops with
473
+ `VersionChangedError`, leaving the destination as it was. An upload stops when a renewed part's instructions
458
474
  differ. A download without a strong ETag resumes from its first byte, and its
459
475
  checkpoint is `nil` when it went to an IO that can neither start over nor say
460
476
  where its bytes began. A transfer paused before it started, or while it opened
@@ -15,8 +15,14 @@ module Files
15
15
  # caller's thread it first asks for the opening range (8 MiB, or a quarter of buffer_bytes when that is less) with
16
16
  # Accept-Encoding: identity. A 206 with a strong ETag and an exact Content-Range and Content-Length binds the
17
17
  # download to that version: every later range is requested with If-Match and must come back as a 206 with the
18
- # exact Content-Range, total, length and ETag, and a 412, or a whole response with any other ETag, stops it with
19
- # VersionChangedError before anything of it is written. Ranges complete in any order, each read straight into one
18
+ # exact Content-Range, total, length and ETag, and a 412, or a whole response with any other ETag, ends the attempt
19
+ # with VersionChangedError before anything of it is written, as do a newer Last-Modified (DownloadDate) and storage's
20
+ # 409 download_source_changed (StorageRetry.source_changed_response?). Once the requests that attempt has in flight
21
+ # have settled, a range still arriving stopping at its next chunk (stop_obsolete_read), a local file (download_file) starts over from its first byte, with a URL the API gives anew and the
22
+ # size, version and date storage answers it with, dropping every byte and claim of the attempt before; an IO does
23
+ # only while nothing has been written to it. Each restart is one of Files.max_network_retries, counted however far
24
+ # the attempt got, so a file that keeps changing fails; none is made once they are spent, or after a cancellation or
25
+ # pause came first. Ranges complete in any order, each read straight into one
20
26
  # String of its length, wait in memory within buffer_bytes, and are written to the destination in order on the
21
27
  # caller's thread, which progress, when given, is then called on. A range is on the network, for its controller,
22
28
  # until its whole body has arrived and been checked. Every request, the opening one and a proof included, waits
@@ -42,6 +48,7 @@ module Files
42
48
  RENEWALS = 2
43
49
  MISMATCH = "Transfer response did not match the request"
44
50
  EXPIRED = "The download URL the API returned has expired, and renewing it did not give one still valid"
51
+ SOURCE_CHANGED = "The remote file changed during the download: storage answered 409 download_source_changed"
45
52
  # The most of a resumed destination's bytes read back at once to check them; never more than a range.
46
53
  VERIFY_CHUNK_BYTES = 1024 * 1024
47
54
  ControlStop = Class.new(StandardError)
@@ -90,6 +97,11 @@ module Files
90
97
  true
91
98
  end
92
99
 
100
+ # The SDK's own local file, whose bytes nobody has been handed: a changed remote file starts it over.
101
+ def resettable?
102
+ true
103
+ end
104
+
93
105
  def restart!
94
106
  @pending = 0
95
107
  end
@@ -164,6 +176,12 @@ module Files
164
176
  !@start.nil? && @io.respond_to?(:seek) && @io.respond_to?(:truncate)
165
177
  end
166
178
 
179
+ # The caller may already have read what was written: a changed remote file starts it over only while nothing
180
+ # has been.
181
+ def resettable?
182
+ false
183
+ end
184
+
167
185
  def restart!
168
186
  @pending = true
169
187
  end
@@ -322,7 +340,8 @@ module Files
322
340
  @digest = OpenSSL::Digest.new('SHA256')
323
341
  @total = nil
324
342
  @version = nil
325
- @download_date = DownloadDate.new(enabled: DownloadDate.enabled(@options, check_download_modification_time))
343
+ @check_dates = DownloadDate.enabled(@options, check_download_modification_time)
344
+ @download_date = DownloadDate.new(enabled: @check_dates)
326
345
  @generation = 0
327
346
  @open = {}
328
347
  @next_number = 0
@@ -386,15 +405,31 @@ module Files
386
405
  @sink.resume_at!(completed)
387
406
  end
388
407
 
389
- # The download, from its URL's lookup to its last write. Any error on the way is raised only when it came before
390
- # any cancellation or pause (Coordinator#run), and a cancellation or pause, such as one from the last progress
391
- # call, is raised in place of a success.
408
+ # The download, from its URL's lookup to its last write, started over when the remote file changed (start_over).
409
+ # Any error on the way is raised only when it came before any cancellation or pause (Coordinator#run), and a
410
+ # cancellation or pause, such as one from the last progress call, is raised in place of a success.
392
411
  def transfer
393
412
  @url = @download_uri || load_url
413
+ @started_at = Clock.now
414
+ restarts = 0
415
+ begin
416
+ fetch_file
417
+ rescue VersionChangedError => e
418
+ raise unless restart?(e, restarts)
419
+
420
+ restarts += 1
421
+ start_over
422
+ retry
423
+ end
424
+ nil
425
+ end
426
+
427
+ # One attempt at the whole file, with the URL it has now. It returns, or raises, only once nothing of it is in
428
+ # flight: the head is fetched on the caller's thread, and pump waits for every range it sent.
429
+ def fetch_file
394
430
  raise stop!(Files::APIError.new("The download URL the API returned is not usable")) unless http_url?(@url)
395
431
 
396
432
  @current = [ @url, @generation, StorageRetry.expires_at(@url) ].freeze
397
- @started_at = Clock.now
398
433
  @start_written = @written
399
434
  # Every byte of a resumed download was written before its pause: storage proves its version with its last byte.
400
435
  @mode = :proof if @version && @written >= @total
@@ -406,7 +441,41 @@ module Files
406
441
  @job.synchronize { observe_stops }
407
442
  raise_outcome
408
443
  @sink.settle!
409
- nil
444
+ end
445
+
446
+ # Whether the remote file's change, error, starts the download over: only when it is the transfer's first stop,
447
+ # with no cancellation, pause or other failure before it, while fewer than Files.max_network_retries restarts were
448
+ # made, and into a local file, or an IO nothing was written to by this download or the one it resumes.
449
+ def restart?(error, restarts)
450
+ return false unless restarts < @max_retries && (@sink.resettable? || (@counted.zero? && @origin.nil?))
451
+
452
+ @job.synchronize do
453
+ observe_stops
454
+ @stop.equal?(error)
455
+ end
456
+ end
457
+
458
+ # Discards the attempt that found the change, whose requests have all settled: the ranges it holds and their
459
+ # bytes, what it wrote to a local file (truncated as the next bytes are written), and its size, version and date,
460
+ # so that nothing of it can be mixed with, or vouch for, the file as it is now. The URL is asked for again, after
461
+ # a cancellation or pause made meanwhile, which comes first. A pause then gives a checkpoint that starts over.
462
+ def start_over
463
+ @job.synchronize do
464
+ release_waiting
465
+ all_items.each { |piece| discard(piece) }
466
+ @open.clear
467
+ @completed.clear
468
+ @stop = nil
469
+ @job.count_retry
470
+ end
471
+ restart_sink if @sink.resettable?
472
+ @next_write = @next_number
473
+ @mode = :probe
474
+ @version = nil
475
+ @total = nil
476
+ @download_date = DownloadDate.new(enabled: @check_dates)
477
+ check_control!
478
+ renew_url
410
479
  end
411
480
 
412
481
  # A refused transfer or a failed write that ended the download first closes a caller's IO.
@@ -455,6 +524,7 @@ module Files
455
524
  raise refusal(FrontendResponseError.new) if StorageRetry.frontend?(response.headers)
456
525
  return :done if response.status == 416 && @written.zero? && response.header("content-range").to_s.strip == "bytes */0"
457
526
  raise refusal(VersionChangedError.new) if response.status == 412
527
+ raise refusal(VersionChangedError.new(SOURCE_CHANGED)) if StorageRetry.source_changed_response?(response.status, response.body, truncated: response.truncated)
458
528
 
459
529
  said_expired = StorageRetry.expired_response?(response.status, response.body, truncated: response.truncated)
460
530
  decision, delay = if said_expired || (response.status == 403 && StorageRetry.expired?(@current[2]))
@@ -719,10 +789,11 @@ module Files
719
789
  url, generation, expires_at = target
720
790
  piece.generation = generation
721
791
  headers = { "Range" => "bytes=#{piece.offset}-#{piece.offset + piece.bytesize - 1}", "Accept-Encoding" => "identity", "If-Match" => @version }
722
- response = @transport.perform(:get, url, headers, connections, timing: timing) { |http| range_body(http, piece) }
792
+ response = @transport.perform(:get, url, headers, connections, timing: timing, on_error_chunk: -> { stop_obsolete_read }) { |http| range_body(http, piece) }
723
793
  return [ :ok, response.body, piece.bytesize ] if response.status.between?(200, 299)
724
794
  return [ :fail, refusal(FrontendResponseError.new) ] if StorageRetry.frontend?(response.headers)
725
795
  return [ :fail, refusal(VersionChangedError.new) ] if response.status == 412
796
+ return [ :fail, refusal(VersionChangedError.new(SOURCE_CHANGED)) ] if StorageRetry.source_changed_response?(response.status, response.body, truncated: response.truncated)
726
797
  return [ :renew, refusal(refused(response)) ] if response.status == 403 && (StorageRetry.expired?(expires_at) || generation < @current[1])
727
798
  return [ :renew, refusal(refused(response)) ] if StorageRetry.expired_response?(response.status, response.body, truncated: response.truncated)
728
799
 
@@ -744,12 +815,23 @@ module Files
744
815
  etag = http["etag"]
745
816
  raise refusal(VersionChangedError.new) if etag && etag != @version
746
817
 
747
- read_exact(http, piece.bytesize)
818
+ read_exact(http, piece.bytesize) { stop_obsolete_read }
819
+ end
820
+
821
+ # On a worker thread, as each chunk arrives of a range's body, or of the body of a refusal or error storage answered
822
+ # it with: once the remote file's change is the transfer's first stop, the range belongs to a version the download
823
+ # will not use, so its read ends there, closing only its own connection, rather than running to its end before the
824
+ # download can start over. A chunk still to come is waited for, within Files.read_timeout. Any other stop, such as a
825
+ # pause, lets the range complete.
826
+ def stop_obsolete_read
827
+ raise Passthrough.new(ControlStop.new), cause: nil if @job.synchronize { @stop.is_a?(VersionChangedError) }
748
828
  end
749
829
 
750
- def read_exact(http, length)
830
+ # Reads a body of exactly length bytes into one String, calling between, when given, before each chunk is kept.
831
+ def read_exact(http, length, &between)
751
832
  data = String.new(capacity: length, encoding: Encoding::BINARY)
752
833
  http.read_body do |chunk|
834
+ between&.call
753
835
  raise refusal(mismatch) if data.bytesize + chunk.bytesize > length
754
836
 
755
837
  data << chunk
@@ -52,8 +52,9 @@ module Files
52
52
  # the response's body; the block reads it as it arrives. An error from the block is raised as it is, unless it is a
53
53
  # network error, which is raised, as one before the response, as a NetworkFailure. timing, when given, is told as
54
54
  # the send starts (connection setup included), as the response headers arrive, and once the block, or the read of
55
- # any other response's body, has finished.
56
- def perform(method, url, headers, connections, body: nil, length: nil, timing: nil, &on_success)
55
+ # any other response's body, has finished. on_error_chunk, when given, is called as each chunk of any other
56
+ # response's body arrives, before it is kept; what it raises ends the request there, closing its connection.
57
+ def perform(method, url, headers, connections, body: nil, length: nil, timing: nil, on_error_chunk: nil, &on_success)
57
58
  uri = ::URI.parse(url)
58
59
  request = Net::HTTPGenericRequest.new(method.to_s.upcase, !body.nil?, true, uri.request_uri, headers)
59
60
  if body.is_a?(String)
@@ -66,7 +67,7 @@ module Files
66
67
  timing&.sending
67
68
  connection(uri, connections).request(request) do |response|
68
69
  timing&.headers
69
- kept, truncated = on_success && response.is_a?(Net::HTTPSuccess) ? [ on_success.call(response), false ] : limited_body(response)
70
+ kept, truncated = on_success && response.is_a?(Net::HTTPSuccess) ? [ on_success.call(response), false ] : limited_body(response, on_error_chunk)
70
71
  timing&.body
71
72
  result = StorageResponse.new(status: response.code.to_i, headers: response.to_hash, body: kept, truncated: truncated)
72
73
  end
@@ -110,11 +111,13 @@ module Files
110
111
  http
111
112
  end
112
113
 
113
- # The first ERROR_BODY_BYTES of a response's body, which is read to its end, and whether it had more.
114
- private def limited_body(response)
114
+ # The first ERROR_BODY_BYTES of a response's body, which is read to its end, and whether it had more. on_chunk, when
115
+ # given, is called as each chunk arrives.
116
+ private def limited_body(response, on_chunk = nil)
115
117
  kept = String.new(encoding: Encoding::BINARY)
116
118
  truncated = false
117
119
  response.read_body do |chunk|
120
+ on_chunk&.call
118
121
  room = ERROR_BODY_BYTES - kept.bytesize
119
122
  truncated ||= chunk.bytesize > room
120
123
  kept << chunk.byteslice(0, room) if room.positive?
@@ -206,11 +209,12 @@ module Files
206
209
  end
207
210
 
208
211
  # Faraday's on_data for one request. It runs a success handler in a Fiber that waits for each chunk as it arrives,
209
- # and keeps the first 64 KiB of any other response.
212
+ # and keeps the first 64 KiB of any other response, calling on_error_chunk, when given, as each of its chunks arrives.
210
213
  class Reader
211
- def initialize(on_success, timing)
214
+ def initialize(on_success, timing, on_error_chunk = nil)
212
215
  @on_success = on_success
213
216
  @timing = timing
217
+ @on_error_chunk = on_error_chunk
214
218
  @fiber = nil
215
219
  @result = nil
216
220
  @kept = String.new(encoding: Encoding::BINARY)
@@ -240,6 +244,7 @@ module Files
240
244
  if @fiber
241
245
  @fiber.resume(chunk.b) if @fiber.alive? && !chunk.empty?
242
246
  else
247
+ @on_error_chunk&.call
243
248
  room = HttpTransport::ERROR_BODY_BYTES - @kept.bytesize
244
249
  @truncated ||= chunk.bytesize > room
245
250
  @kept << chunk.b.byteslice(0, room) if room.positive?
@@ -284,11 +289,11 @@ module Files
284
289
  end
285
290
 
286
291
  # As HttpTransport#perform, through the client's remote_request.
287
- def perform(method, url, headers, _connections, body: nil, length: nil, timing: nil, &on_success)
292
+ def perform(method, url, headers, _connections, body: nil, length: nil, timing: nil, on_error_chunk: nil, &on_success)
288
293
  raise ArgumentError, "a client transfer sends a String body of #{length} bytes" unless body.nil? || body.is_a?(String)
289
294
 
290
295
  @lock.synchronize do
291
- reader = on_success && Reader.new(on_success, timing)
296
+ reader = on_success && Reader.new(on_success, timing, on_error_chunk)
292
297
  timing&.sending
293
298
  begin
294
299
  response = ApiClient.single_attempt do
@@ -14,7 +14,8 @@ module Files
14
14
  # 3xx (redirects are never followed) and a success that does not acknowledge the part. Each retry is a new
15
15
  # admission, within the caller's Files.max_network_retries, and never for a part whose instructions say
16
16
  # retry_parts: false. A 400 or 403 that says its URL has expired (expired_response?) is renewed instead, as one of
17
- # those retries, as is a 403 for a URL whose stated expiry has passed.
17
+ # those retries, as is a 403 for a URL whose stated expiry has passed. A 409 that says a download's file changed
18
+ # since its URL was given (source_changed_response?) is that change, never retried with the same URL.
18
19
  module StorageRetry
19
20
  THROTTLE_STATUSES = [ 429, 503 ].freeze
20
21
  RETRY_STATUSES = [ 500, 502, 504 ].freeze
@@ -47,6 +48,9 @@ module Files
47
48
  EXPIRY_MARKERS = [ "request has expired", "<code>expiredtoken</code>", "signature not valid in the specified time frame" ].freeze
48
49
  # The type of the JSON error Files.com answers an expired download or upload URL of its own with.
49
50
  EXPIRED_TYPES = %w[download_request_expired upload_request_expired].freeze
51
+ # The type of the JSON error a Files.com download URL is refused with, as a 409, once its file has changed since
52
+ # the URL was given, such as a Files Agent file whose size no longer matches the size the URL was given for.
53
+ SOURCE_CHANGED_TYPE = "download_source_changed"
50
54
  # A body that begins, after JSON's white space, as a JSON object, array or string, well formed or not.
51
55
  JSON_START = /\A[ \t\r\n]*[\[{"]/
52
56
 
@@ -79,10 +83,24 @@ module Files
79
83
  end
80
84
  return false if truncated || body.bytesize > EXPIRY_SCAN_BYTES
81
85
 
82
- error = JSON.parse(scanned.force_encoding(Encoding::UTF_8))
83
- error.is_a?(Hash) && EXPIRED_TYPES.include?(error["type"])
86
+ EXPIRED_TYPES.include?(error_type(body))
87
+ end
88
+
89
+ # Whether a download URL was refused because its file changed since the URL was given: a 409 whose whole body,
90
+ # within EXPIRY_SCAN_BYTES, is a JSON object whose type is SOURCE_CHANGED_TYPE. Judged by that type alone, never
91
+ # by text inside the body, nor from a body truncated or longer than that; any other 409 is not.
92
+ def self.source_changed_response?(status, body, truncated: false)
93
+ return false unless status == 409 && body.is_a?(String) && !truncated && body.bytesize <= EXPIRY_SCAN_BYTES
94
+
95
+ error_type(body) == SOURCE_CHANGED_TYPE
96
+ end
97
+
98
+ # The type of the JSON error object that is the whole of body, or nil when body is not one.
99
+ def self.error_type(body)
100
+ error = JSON.parse(body.b.force_encoding(Encoding::UTF_8))
101
+ error["type"] if error.is_a?(Hash)
84
102
  rescue JSON::ParserError, EncodingError
85
- false
103
+ nil
86
104
  end
87
105
 
88
106
  # Seconds to wait, never negative and never shortened. Infinity when the value cannot be scheduled.
@@ -24,15 +24,17 @@ RSpec.describe Files::File, "native helpers" do
24
24
  allow(Files::ApiClient).to receive(:default_conn).and_return(stubbed_api_client.conn)
25
25
  end
26
26
 
27
+ # A class call without a client makes the thread's default API client, which the thread keeps, from the stubbed
28
+ # default_conn: it is put back as it was, so later examples never send through these stubs.
27
29
  around do |example|
28
- previous = [ Files.api_key, Files.max_network_retries, Thread.current[:files_api_client] ]
30
+ previous = [ Files.api_key, Files.max_network_retries, Thread.current[:files_api_client], Thread.current[:files_api_client_default_client] ]
29
31
  Files.api_key = "native-helper-fixture-key"
30
32
  Files.max_network_retries = 0
31
33
  example.run
32
34
  ensure
33
35
  gate.close
34
36
  servers.each(&:close)
35
- Files.api_key, Files.max_network_retries, Thread.current[:files_api_client] = previous
37
+ Files.api_key, Files.max_network_retries, Thread.current[:files_api_client], Thread.current[:files_api_client_default_client] = previous
36
38
  end
37
39
 
38
40
  def active_client(client)
@@ -51,10 +51,13 @@ RSpec.describe Files::File, "adaptive downloads" do
51
51
  TransferServer.response("206 Partial Content", { "ETag" => etag, "Content-Range" => "bytes #{first}-#{last}/#{content.bytesize}", "Content-Length" => body.bytesize }, body)
52
52
  end
53
53
 
54
- # The API, made Files.base_url, answering each file lookup with a download URL on store.
55
- def api_server(store)
54
+ # The API, made Files.base_url, answering each file lookup with a download URL on store, or on the store it returns
55
+ # when it is a callable, after calling on_lookup when given.
56
+ def api_server(store, on_lookup: nil)
56
57
  api = TransferServer.new(concurrent: true) do |_request|
57
- body = JSON.generate(path: "report.bin", type: "file", download_uri: store.url("/objects/report.bin"))
58
+ on_lookup&.call
59
+ target = store.respond_to?(:call) ? store.call : store
60
+ body = JSON.generate(path: "report.bin", type: "file", download_uri: target.url("/objects/report.bin"))
58
61
  TransferServer.response("200 OK", { "Content-Type" => "application/json", "Content-Length" => body.bytesize }, body)
59
62
  end
60
63
  servers << api
@@ -879,6 +882,187 @@ RSpec.describe Files::File, "adaptive downloads" do
879
882
  end
880
883
  end
881
884
 
885
+ # The file as it is after the change: five full 64 KiB ranges and a short one, fewer bytes than before.
886
+ describe "a remote file that changes" do
887
+ let(:changed) { Random.new(9).bytes((5 * 65_536) + 123) }
888
+ let(:refused) { TransferServer.response("412 Precondition Failed", { "Content-Length" => 0 }) }
889
+
890
+ # Ranges after the opening one are refused as another version, with responses (default ones when nil).
891
+ def refusing_ranges(response = nil)
892
+ storage_server(answer: ->(request, default) { request.headers["if-match"] ? (response || refused) : default })
893
+ end
894
+
895
+ def conflict(type, body)
896
+ TransferServer.response("409 Conflict", { "Content-Type" => type, "Content-Length" => body.bytesize }, body)
897
+ end
898
+
899
+ # Four ranges of the old version are in flight when one of them is refused. A sibling's answer, its range body or
900
+ # the body of a 500, trickles in 256 bytes at a time, seconds from its end: its read stops at its next chunk, so the
901
+ # restart, which joins every request of the attempt first, asks for the new URL while that body is still unfinished.
902
+ # Nothing of the old version, its bytes or its date, reaches the new file.
903
+ { "206 range body" => nil, "500 error body" => "500 Internal Server Error" }.each do |label, error_status|
904
+ it "stops an obsolete #{label} still arriving, joins the attempt's requests, then starts a local file over with a new URL, size, version and date" do
905
+ Files.max_network_retries = 2
906
+ lock = Mutex.new
907
+ trickle = { started: false, finished: false }
908
+ finished_at_lookup = []
909
+ dated = ->(response, modified) { response.sub("\r\n", "\r\nLast-Modified: #{modified}\r\n") }
910
+ old = storage_server(answer: lambda { |request, default|
911
+ next dated.call(default, "Wed, 21 Oct 2015 07:28:00 GMT") unless request.headers["if-match"]
912
+
913
+ case request.headers["range"]
914
+ when "bytes=65536-131071"
915
+ wait_until { lock.synchronize { trickle[:started] } }
916
+ refused
917
+ when "bytes=131072-196607"
918
+ head, body = if error_status
919
+ [ TransferServer.response(error_status, { "Content-Length" => 65_536 }).delete_suffix("\r\n\r\n"), ("e" * 65_536).b ]
920
+ else
921
+ default.split("\r\n\r\n", 2)
922
+ end
923
+ pieces = (0...body.bytesize).step(256).map { |offset| body.byteslice(offset, 256) }
924
+ [ "#{head}\r\n\r\n#{pieces.shift}", -> { lock.synchronize { trickle[:started] = true } },
925
+ *pieces.flat_map { |piece| [ -> { sleep 0.02 }, piece ] }, -> { lock.synchronize { trickle[:finished] = true } } ]
926
+ else
927
+ default
928
+ end
929
+ }
930
+ )
931
+ store = storage_server(changed, etag: "\"v2\"", answer: ->(_request, default) { dated.call(default, "Wed, 21 Oct 2015 07:28:01 GMT") })
932
+ api_server(store, on_lookup: -> { lock.synchronize { finished_at_lookup << trickle[:finished] } })
933
+
934
+ Files::Transfer::Job.open(**transfer, concurrency: 4) do |job|
935
+ Dir.mktmpdir do |dir|
936
+ local_path = File.join(dir, "report.bin")
937
+ remote_file(old).download_file(local_path, transfer: job)
938
+ expect(File.binread(local_path)).to eq(changed)
939
+ end
940
+ expect(job.diagnostics.values_at(:retries, :held_bytes, :requests)).to eq([ 1, 0, 0 ])
941
+ end
942
+
943
+ expect(finished_at_lookup).to eq([ false ])
944
+ expect(old.requests.size).to eq(5)
945
+ expect(store.requests.first.headers.values_at("range", "if-match", "if-unmodified-since")).to eq([ "bytes=0-65535", nil, nil ])
946
+ expect(store.requests.drop(1).map { |request| request.headers["if-match"] }.uniq).to eq([ "\"v2\"" ])
947
+ end
948
+ end
949
+
950
+ [ 0, 2 ].each do |retries|
951
+ it "raises VersionChangedError after exactly #{retries} restarts when the file has changed again on every attempt" do
952
+ Files.max_network_retries = retries
953
+ store = refusing_ranges
954
+ api = api_server(store)
955
+
956
+ Files::Transfer::Job.open(**transfer) do |job|
957
+ Dir.mktmpdir do |dir|
958
+ # Each attempt writes its opening range before it finds the change, and still counts.
959
+ expect { described_class.new(path: "report.bin").download_file(File.join(dir, "report.bin"), transfer: job) }
960
+ .to raise_error(Files::Transfer::VersionChangedError)
961
+ end
962
+ expect(job.diagnostics[:retries]).to eq(retries)
963
+ end
964
+ expect(api.requests.size).to eq(retries + 1)
965
+ expect(ranges(store).count("bytes=0-65535")).to eq(retries + 1)
966
+ end
967
+ end
968
+
969
+ it "starts over on storage's 409 download_source_changed, for an opening request into an IO not yet written to and for a range of a local file" do
970
+ Files.max_network_retries = 1
971
+ typed = conflict("application/json", JSON.generate(type: "download_source_changed", error: "The source file changed while it was being downloaded.", 'http-code': 409))
972
+
973
+ old = storage_server(answer: ->(_request, _default) { typed })
974
+ api = api_server(storage_server(changed, etag: "\"v2\""))
975
+ remote_file(old).download_content(sink, transfer: transfer)
976
+ expect(sink.string).to eq(changed)
977
+ expect([ old.requests.size, api.requests.size ]).to eq([ 1, 1 ])
978
+
979
+ old = refusing_ranges(typed)
980
+ api = api_server(storage_server(changed, etag: "\"v2\""))
981
+ Dir.mktmpdir do |dir|
982
+ local_path = File.join(dir, "report.bin")
983
+ remote_file(old).download_file(local_path, transfer: transfer)
984
+ expect(File.binread(local_path)).to eq(changed)
985
+ end
986
+ expect(api.requests.size).to eq(1)
987
+ end
988
+
989
+ it "fails on any other 409 without asking for a new URL" do
990
+ Files.max_network_retries = 2
991
+ [
992
+ conflict("application/json", JSON.generate(type: "processing-failure/conflict", error: "download_source_changed mentioned in another error", 'http-code': 409)),
993
+ conflict("text/plain", "download_source_changed")
994
+ ].each do |other|
995
+ store = refusing_ranges(other)
996
+ api = api_server(store)
997
+ Dir.mktmpdir do |dir|
998
+ expect { remote_file(store).download_file(File.join(dir, "report.bin"), transfer: transfer) }
999
+ .to raise_error(Files::APIError, "Transfer request failed") { |error| expect(error.http_status).to eq(409) }
1000
+ end
1001
+ expect(api.requests).to be_empty
1002
+ end
1003
+ end
1004
+
1005
+ it "starts over with the newer date as its baseline when storage ignores If-Unmodified-Since and answers a newer Last-Modified" do
1006
+ Files.max_network_retries = 1
1007
+ baseline = "Wed, 21 Oct 2015 07:28:00 GMT"
1008
+ newer = "Wed, 21 Oct 2015 07:28:01 GMT"
1009
+ store = storage_server(answer: lambda { |request, _default|
1010
+ content, modified = store.requests.size == 1 ? [ payload, baseline ] : [ changed, newer ]
1011
+ stored(content, request.headers["range"], "W/\"v1\"").sub("\r\n", "\r\nLast-Modified: #{modified}\r\n")
1012
+ }
1013
+ )
1014
+ api = api_server(store)
1015
+
1016
+ Dir.mktmpdir do |dir|
1017
+ local_path = File.join(dir, "report.bin")
1018
+ remote_file(store).download_file(local_path, transfer: transfer)
1019
+ expect(File.binread(local_path)).to eq(changed)
1020
+ end
1021
+ expect(store.requests.map { |request| request.headers.values_at("range", "if-unmodified-since") })
1022
+ .to eq([ [ "bytes=0-65535", nil ], [ nil, baseline ], [ "bytes=0-65535", nil ], [ nil, newer ] ])
1023
+ expect(api.requests.size).to eq(1)
1024
+ end
1025
+
1026
+ it "raises instead of starting over an IO it has written to, and closes it" do
1027
+ Files.max_network_retries = 2
1028
+ store = refusing_ranges
1029
+ api = api_server(store)
1030
+
1031
+ expect { remote_file(store).download_content(sink, transfer: transfer) }.to raise_error(Files::Transfer::VersionChangedError)
1032
+ expect(sink.string).to eq(payload.byteslice(0, 65_536))
1033
+ expect(sink).to be_closed
1034
+ expect(api.requests).to be_empty
1035
+ end
1036
+
1037
+ it "starts nothing more when cancelled before the change is settled, or while the restart asks for its URL" do
1038
+ Files.max_network_retries = 2
1039
+ control = Files::Transfer::Control.new
1040
+ store = storage_server(answer: lambda { |request, default|
1041
+ next default unless request.headers["if-match"]
1042
+
1043
+ control.cancel
1044
+ refused
1045
+ }
1046
+ )
1047
+ api = api_server(store)
1048
+ Dir.mktmpdir do |dir|
1049
+ expect { remote_file(store).download_file(File.join(dir, "report.bin"), transfer: transfer.merge(control: control)) }
1050
+ .to raise_error(Files::Transfer::CancelledError)
1051
+ end
1052
+ expect(api.requests).to be_empty
1053
+
1054
+ control = Files::Transfer::Control.new
1055
+ store = refusing_ranges
1056
+ api = api_server(store, on_lookup: -> { control.cancel })
1057
+ Dir.mktmpdir do |dir|
1058
+ expect { remote_file(store).download_file(File.join(dir, "report.bin"), transfer: transfer.merge(control: control)) }
1059
+ .to raise_error(Files::Transfer::CancelledError)
1060
+ end
1061
+ expect(api.requests.size).to eq(1)
1062
+ expect(ranges(store).count("bytes=0-65535")).to eq(1)
1063
+ end
1064
+ end
1065
+
882
1066
  describe "refusals" do
883
1067
  it "refuses a response from the Files.com web app before writing any of it, and closes the IO" do
884
1068
  page = "<html>Sign in</html>"
@@ -1034,6 +1218,38 @@ RSpec.describe Files::File, "adaptive downloads" do
1034
1218
  end
1035
1219
  end
1036
1220
 
1221
+ # The resume's own URL still serves the old version, which storage refuses: within its retries the local file
1222
+ # starts over from its first byte, with a new URL and the new size, dropping the bytes the checkpoint vouched for.
1223
+ it "starts a resumed local file over, with a new URL and size, when the version it paused with has changed" do
1224
+ Files.max_network_retries = 1
1225
+ changed = false
1226
+ new_content = Random.new(9).bytes((5 * 65_536) + 123)
1227
+ store, control = pause_after_first_range(lambda { |request, default|
1228
+ changed && request.headers["if-match"] ? TransferServer.response("412 Precondition Failed", { "Content-Length" => 0 }) : default
1229
+ }
1230
+ )
1231
+ fresh = storage_server(new_content, etag: "\"v2\"")
1232
+ # The resume looks its URL up (the old one), and the restart a URL for the new version.
1233
+ lookups = 0
1234
+ api_server(-> { (lookups += 1) == 1 ? store : fresh })
1235
+
1236
+ Dir.mktmpdir do |dir|
1237
+ local_path = File.join(dir, "report.bin")
1238
+ paused = nil
1239
+ expect { remote_file(store).download_file(local_path, transfer: transfer.merge(concurrency: 1, control: control)) }
1240
+ .to raise_error(Files::Transfer::PausedError) { |error| paused = error }
1241
+ changed = true
1242
+ resumed_from = store.requests.size
1243
+
1244
+ described_class.resume_download(paused.checkpoint, nil, {}, transfer: transfer)
1245
+
1246
+ expect(File.binread(local_path)).to eq(new_content)
1247
+ expect(store.requests.drop(resumed_from).map { |request| request.headers.values_at("range", "if-match") }).to eq([ [ "bytes=131072-196607", "\"v1\"" ] ])
1248
+ expect(fresh.requests.first.headers.values_at("range", "if-match")).to eq([ "bytes=0-65535", nil ])
1249
+ end
1250
+ expect(lookups).to eq(2)
1251
+ end
1252
+
1037
1253
  it "resumes into the same IO only" do
1038
1254
  store, control = pause_after_first_range
1039
1255
  api_server(store)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: files.com
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.828
4
+ version: 1.1.829
5
5
  platform: ruby
6
6
  authors:
7
7
  - files.com