files.com 1.1.827 → 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 (454) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +16 -0
  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 +7 -5
  27. data/doc/Files/ApiClient/RequestLogContext.html +29 -29
  28. data/doc/Files/ApiClient/TransferSettings.html +29 -29
  29. data/doc/Files/ApiClient.html +210 -148
  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 +1081 -1073
  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 +88 -18
  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 +85 -70
  369. data/doc/Files/Transfer/DownloadDate.html +467 -0
  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 +3 -3
  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 +167 -101
  436. data/doc/_index.html +8 -1
  437. data/doc/class_list.html +1 -1
  438. data/doc/file.README.html +11 -2
  439. data/doc/index.html +11 -2
  440. data/doc/method_list.html +2815 -2727
  441. data/doc/top-level-namespace.html +1 -1
  442. data/docs/file.md +21 -5
  443. data/lib/files.com/api.rb +1 -0
  444. data/lib/files.com/api_client.rb +23 -2
  445. data/lib/files.com/models/file.rb +11 -7
  446. data/lib/files.com/transfer/attempts.rb +3 -2
  447. data/lib/files.com/transfer/download_coordinator.rb +104 -16
  448. data/lib/files.com/transfer/download_date.rb +44 -0
  449. data/lib/files.com/transfer/http_transport.rb +14 -9
  450. data/lib/files.com/transfer/storage_retry.rb +22 -4
  451. data/lib/files.com.rb +3 -0
  452. data/spec/models/native_file_spec.rb +4 -2
  453. data/spec/transfer/adaptive_download_spec.rb +335 -4
  454. metadata +3 -1
@@ -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
@@ -103,7 +106,7 @@ RSpec.describe Files::File, "adaptive downloads" do
103
106
  it "stops with VersionChangedError when storage no longer has the version, keeping what was written and closing the IO" do
104
107
  store = storage_server(answer: ->(request, default) { request.headers["if-match"] ? TransferServer.response("412 Precondition Failed", { "Content-Length" => 0 }) : default })
105
108
 
106
- expect { remote_file(store).download_content(sink, transfer: transfer) }.to raise_error(Files::Transfer::VersionChangedError)
109
+ expect { remote_file(store).download_content(sink, transfer: transfer, check_download_modification_time: false) }.to raise_error(Files::Transfer::VersionChangedError)
107
110
  expect(sink.string).to eq(payload.byteslice(0, 65_536))
108
111
  expect(sink).to be_closed
109
112
  end
@@ -664,6 +667,121 @@ RSpec.describe Files::File, "adaptive downloads" do
664
667
  end
665
668
 
666
669
  describe "without a bound version" do
670
+ it "keeps its disabled snapshot through a global change and does not send the local setting as an API header" do
671
+ original = Files.check_download_modification_time
672
+ Files.check_download_modification_time = false
673
+ Files.max_network_retries = 1
674
+ baseline = "Wed, 21 Oct 2015 07:28:00 GMT"
675
+ store = storage_server(answer: lambda { |_request, _default|
676
+ first = store.requests.size == 1
677
+ Files.check_download_modification_time = true
678
+ modified = first ? baseline : "Wed, 21 Oct 2015 07:28:01 GMT"
679
+ TransferServer.response("200 OK", { "Content-Length" => payload.bytesize, "Last-Modified" => modified }, first ? payload.byteslice(0, 4096) : payload)
680
+ }
681
+ )
682
+ api = api_server(store)
683
+ Dir.mktmpdir do |dir|
684
+ remote = described_class.new({ path: "report.bin" }, { check_download_modification_time: false })
685
+ local = File.join(dir, "snapshot.bin")
686
+ remote.download_file(local, transfer: transfer)
687
+ expect(File.binread(local)).to eq(payload)
688
+ end
689
+ expect(store.requests.map { |request| request.headers["if-unmodified-since"] }).to eq([ nil, nil ])
690
+ expect(api.requests).not_to be_empty
691
+ expect(api.requests).to all(satisfy { |request| !request.headers.key?("check_download_modification_time") })
692
+ ensure
693
+ Files.check_download_modification_time = original
694
+ end
695
+
696
+ [ [ false, nil ], [ true, false ], [ false, true ] ].each do |client_check, local_check|
697
+ it "resolves client and local timestamp checks once (#{client_check}, #{local_check.inspect})" do
698
+ baseline = "Wed, 21 Oct 2015 07:28:00 GMT"
699
+ newer = "Wed, 21 Oct 2015 07:28:01 GMT"
700
+ store = storage_server(etag: "W/\"v1\"", answer: lambda { |_request, default|
701
+ modified = store.requests.size == 1 ? baseline : newer
702
+ default.sub("\r\n", "\r\nLast-Modified: #{modified}\r\n")
703
+ }
704
+ )
705
+ client = Files::ApiClient.new(check_download_modification_time: client_check)
706
+ remote = described_class.new({ path: "report.bin", download_uri: store.url("/objects/report.bin") }, { client: client })
707
+ guarded = local_check.nil? ? client_check : local_check
708
+ download = -> { remote.download_content(sink, transfer: transfer, check_download_modification_time: local_check) }
709
+ if guarded
710
+ expect(&download).to raise_error(Files::Transfer::VersionChangedError)
711
+ else
712
+ download.call
713
+ expect(sink.string).to eq(payload)
714
+ end
715
+ expect(store.requests.map { |request| request.headers["if-unmodified-since"] }).to eq([ nil, guarded ? baseline : nil ])
716
+ end
717
+ end
718
+
719
+ [ "Wed, 21 Oct 2015 07:28:00 GMT", "invalid date", nil ].each do |modified|
720
+ it "uses one valid Last-Modified for the fallback without binding ranges (#{modified.inspect})" do
721
+ store = storage_server(etag: "W/\"v1\"", answer: lambda { |_request, default|
722
+ modified ? default.sub("\r\n", "\r\nLast-Modified: #{modified}\r\n") : default
723
+ }
724
+ )
725
+ remote_file(store).download_content(sink, transfer: transfer)
726
+ expect(sink.string).to eq(payload)
727
+ expect(ranges(store)).to eq([ "bytes=0-65535", nil ])
728
+ expected = modified&.start_with?("Wed,") ? modified : nil
729
+ expect(store.requests.map { |request| request.headers["if-unmodified-since"] }).to eq([ nil, expected ])
730
+ end
731
+ end
732
+
733
+ [ false, true ].each do |ignored|
734
+ it "refuses a newer date before fallback bytes are written, conditional ignored=#{ignored}" do
735
+ baseline = "Wed, 21 Oct 2015 07:28:00 GMT"
736
+ newer = "Wed, 21 Oct 2015 07:28:01 GMT"
737
+ store = storage_server(etag: "W/\"v1\"", answer: lambda { |request, default|
738
+ if store.requests.size == 1
739
+ default.sub("\r\n", "\r\nLast-Modified: #{baseline}\r\n")
740
+ elsif !ignored && request.headers["if-unmodified-since"] == baseline
741
+ TransferServer.response("412 Precondition Failed", { "Content-Length" => 0 })
742
+ else
743
+ default.sub("\r\n", "\r\nLast-Modified: #{newer}\r\n")
744
+ end
745
+ }
746
+ )
747
+ expect { remote_file(store).download_content(sink, transfer: transfer) }.to raise_error(Files::Transfer::VersionChangedError)
748
+ expect(sink.string).to be_empty
749
+ expect(store.requests.map { |request| request.headers["if-unmodified-since"] }).to eq([ nil, baseline ])
750
+ end
751
+ end
752
+
753
+ it "retains its date through a short response, retry and URL renewal" do
754
+ Files.max_network_retries = 2
755
+ baseline = "Wed, 21 Oct 2015 07:28:00 GMT"
756
+ store = storage_server(answer: lambda { |_request, _default|
757
+ count = store.requests.size
758
+ if count == 2
759
+ TransferServer.response("403 Forbidden", { "Content-Length" => 34 }, "<Error>Request has expired</Error>")
760
+ else
761
+ TransferServer.response("200 OK", { "Content-Length" => payload.bytesize, "Last-Modified" => baseline }, count == 1 ? payload.byteslice(0, 4096) : payload)
762
+ end
763
+ }
764
+ )
765
+ api_server(store)
766
+ Dir.mktmpdir do |dir|
767
+ local = File.join(dir, "date.bin")
768
+ remote_file(store).download_file(local, transfer: transfer)
769
+ expect(File.binread(local)).to eq(payload)
770
+ end
771
+ expect(store.requests.map { |request| request.headers["if-unmodified-since"] }).to eq([ nil, baseline, baseline ])
772
+ end
773
+
774
+ it "keeps If-Match precedence when later ranges declare newer dates" do
775
+ store = storage_server(answer: lambda { |request, default|
776
+ modified = request.headers["if-match"] ? "Wed, 21 Oct 2015 07:28:01 GMT" : "Wed, 21 Oct 2015 07:28:00 GMT"
777
+ default.sub("\r\n", "\r\nLast-Modified: #{modified}\r\n")
778
+ }
779
+ )
780
+ remote_file(store).download_content(sink, transfer: transfer)
781
+ expect(sink.string).to eq(payload)
782
+ expect(store.requests.drop(1)).to all(satisfy { |request| request.headers["if-match"] == "\"v1\"" && !request.headers.key?("if-unmodified-since") })
783
+ end
784
+
667
785
  it "streams the whole response once when the opening range has a weak ETag" do
668
786
  store = storage_server(etag: "W/\"v1\"")
669
787
 
@@ -764,6 +882,187 @@ RSpec.describe Files::File, "adaptive downloads" do
764
882
  end
765
883
  end
766
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
+
767
1066
  describe "refusals" do
768
1067
  it "refuses a response from the Files.com web app before writing any of it, and closes the IO" do
769
1068
  page = "<html>Sign in</html>"
@@ -919,6 +1218,38 @@ RSpec.describe Files::File, "adaptive downloads" do
919
1218
  end
920
1219
  end
921
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
+
922
1253
  it "resumes into the same IO only" do
923
1254
  store, control = pause_after_first_range
924
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.827
4
+ version: 1.1.829
5
5
  platform: ruby
6
6
  authors:
7
7
  - files.com
@@ -537,6 +537,7 @@ files:
537
537
  - doc/Files/Transfer/DownloadCoordinator/FileSink.html
538
538
  - doc/Files/Transfer/DownloadCoordinator/IoSink.html
539
539
  - doc/Files/Transfer/DownloadCoordinator/Piece.html
540
+ - doc/Files/Transfer/DownloadDate.html
540
541
  - doc/Files/Transfer/FileSlots.html
541
542
  - doc/Files/Transfer/FrontendResponseError.html
542
543
  - doc/Files/Transfer/Holds.html
@@ -925,6 +926,7 @@ files:
925
926
  - lib/files.com/transfer/clock.rb
926
927
  - lib/files.com/transfer/controller.rb
927
928
  - lib/files.com/transfer/download_coordinator.rb
929
+ - lib/files.com/transfer/download_date.rb
928
930
  - lib/files.com/transfer/errors.rb
929
931
  - lib/files.com/transfer/http_transport.rb
930
932
  - lib/files.com/transfer/job.rb