files.com 1.0.133 → 1.0.138
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_VERSION +1 -1
- data/build.sh +5 -0
- data/docs/app.md +4 -0
- data/docs/sso_strategy.md +1 -1
- data/docs/user.md +4 -4
- data/lib/files.com/api_client.rb +6 -10
- data/lib/files.com/errors.rb +156 -9
- data/lib/files.com/models/app.rb +10 -0
- data/lib/files.com/models/sso_strategy.rb +1 -1
- data/lib/files.com/models/user.rb +4 -4
- data/lib/files.com/uri.rb +5 -11
- data/spec/uri_spec.rb +5 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee93992620b1a364ee05b7064f7c180b10c10a44f343ef0d946c1c489538cd10
|
4
|
+
data.tar.gz: 2e13bdb3dde8aa1907ecab9e3ee0954a19b5e20fef0fc636a9859eacd8b183a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de65d0ca807e2d162205891478013b969e99b2c8cba34731eb967364bcf4d949f0ccec766517d4104c0a429c3257bab0e495b5b4eb395f1df68626ced81a463f
|
7
|
+
data.tar.gz: cf26395290eb7d9b7cf7f6b7155ff0d807f0da21c675120191c0ba702efefb5c52261314c63635709eedb947f29170621d1337496cdf8ae087e4e1496299e473
|
data/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.138
|
data/build.sh
ADDED
data/docs/app.md
CHANGED
@@ -17,6 +17,8 @@
|
|
17
17
|
"remote_server_type": "",
|
18
18
|
"folder_behavior_type": "",
|
19
19
|
"external_homepage_url": "",
|
20
|
+
"marketing_youtube_url": "",
|
21
|
+
"tutorial_youtube_url": "",
|
20
22
|
"app_type": "",
|
21
23
|
"featured": true
|
22
24
|
}
|
@@ -33,6 +35,8 @@
|
|
33
35
|
* `remote_server_type` (string): Associated Remote Server type, if any
|
34
36
|
* `folder_behavior_type` (string): Associated Folder Behavior type, if any
|
35
37
|
* `external_homepage_url` (string): Link to external homepage
|
38
|
+
* `marketing_youtube_url` (string): Marketing video page
|
39
|
+
* `tutorial_youtube_url` (string): Tutorial video page
|
36
40
|
* `app_type` (string): The type of the App
|
37
41
|
* `featured` (boolean): Is featured on the App listing?
|
38
42
|
|
data/docs/sso_strategy.md
CHANGED
@@ -77,7 +77,7 @@
|
|
77
77
|
* `provision_group_inclusion` (string): Comma-separated list of group names for groups (with optional wildcards) that will be auto-provisioned.
|
78
78
|
* `provision_group_required` (string): Comma or newline separated list of group names (with optional wildcards) to require membership for user provisioning.
|
79
79
|
* `provision_site_admin_groups` (string): Comma-separated list of group names whose members will be created as Site Admins.
|
80
|
-
* `provision_attachments_permission` (boolean): Auto-provisioned users get Sharing permission
|
80
|
+
* `provision_attachments_permission` (boolean): DEPRECATED: Auto-provisioned users get Sharing permission. Use a Group with the Bundle permission instead.
|
81
81
|
* `provision_dav_permission` (boolean): Auto-provisioned users get WebDAV permission?
|
82
82
|
* `provision_ftp_permission` (boolean): Auto-provisioned users get FTP permission?
|
83
83
|
* `provision_sftp_permission` (boolean): Auto-provisioned users get SFTP permission?
|
data/docs/user.md
CHANGED
@@ -60,7 +60,7 @@
|
|
60
60
|
* `username` (string): User's username
|
61
61
|
* `admin_group_ids` (array): List of group IDs of which this user is an administrator
|
62
62
|
* `allowed_ips` (string): A list of allowed IPs if applicable. Newline delimited
|
63
|
-
* `attachments_permission` (boolean): Can the user create Bundles (aka Share Links)?
|
63
|
+
* `attachments_permission` (boolean): DEPRECATED: Can the user create Bundles (aka Share Links)? Use the bundle permission instead.
|
64
64
|
* `api_keys_count` (int64): Number of api keys associated with this user
|
65
65
|
* `authenticate_until` (date-time): Scheduled Date/Time at which user will be deactivated
|
66
66
|
* `authentication_method` (string): How is this user authenticated?
|
@@ -217,7 +217,7 @@ Files::User.create(
|
|
217
217
|
* `password_confirmation` (string): Optional, but if provided, we will ensure that it matches the value sent in `password`.
|
218
218
|
* `announcements_read` (boolean): Signifies that the user has read all the announcements in the UI.
|
219
219
|
* `allowed_ips` (string): A list of allowed IPs if applicable. Newline delimited
|
220
|
-
* `attachments_permission` (boolean): Can the user create Bundles (aka Share Links)?
|
220
|
+
* `attachments_permission` (boolean): DEPRECATED: Can the user create Bundles (aka Share Links)? Use the bundle permission instead.
|
221
221
|
* `authenticate_until` (string): Scheduled Date/Time at which user will be deactivated
|
222
222
|
* `authentication_method` (string): How is this user authenticated?
|
223
223
|
* `billing_permission` (boolean): Allow this user to perform operations on the account, payments, and invoices?
|
@@ -348,7 +348,7 @@ Files::User.update(id,
|
|
348
348
|
* `password_confirmation` (string): Optional, but if provided, we will ensure that it matches the value sent in `password`.
|
349
349
|
* `announcements_read` (boolean): Signifies that the user has read all the announcements in the UI.
|
350
350
|
* `allowed_ips` (string): A list of allowed IPs if applicable. Newline delimited
|
351
|
-
* `attachments_permission` (boolean): Can the user create Bundles (aka Share Links)?
|
351
|
+
* `attachments_permission` (boolean): DEPRECATED: Can the user create Bundles (aka Share Links)? Use the bundle permission instead.
|
352
352
|
* `authenticate_until` (string): Scheduled Date/Time at which user will be deactivated
|
353
353
|
* `authentication_method` (string): How is this user authenticated?
|
354
354
|
* `billing_permission` (boolean): Allow this user to perform operations on the account, payments, and invoices?
|
@@ -500,7 +500,7 @@ user.update(
|
|
500
500
|
* `password_confirmation` (string): Optional, but if provided, we will ensure that it matches the value sent in `password`.
|
501
501
|
* `announcements_read` (boolean): Signifies that the user has read all the announcements in the UI.
|
502
502
|
* `allowed_ips` (string): A list of allowed IPs if applicable. Newline delimited
|
503
|
-
* `attachments_permission` (boolean): Can the user create Bundles (aka Share Links)?
|
503
|
+
* `attachments_permission` (boolean): DEPRECATED: Can the user create Bundles (aka Share Links)? Use the bundle permission instead.
|
504
504
|
* `authenticate_until` (string): Scheduled Date/Time at which user will be deactivated
|
505
505
|
* `authentication_method` (string): How is this user authenticated?
|
506
506
|
* `billing_permission` (boolean): Allow this user to perform operations on the account, payments, and invoices?
|
data/lib/files.com/api_client.rb
CHANGED
@@ -277,16 +277,12 @@ module Files
|
|
277
277
|
code: error_data[:code] || resp.http_status,
|
278
278
|
}
|
279
279
|
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
PermissionError.new(error_data[:message], opts)
|
287
|
-
when 429
|
288
|
-
RateLimitError.new(error_data[:message], opts)
|
289
|
-
else
|
280
|
+
return APIError.new(error_data[:message], opts) unless resp&.data&.dig(:type)
|
281
|
+
|
282
|
+
begin
|
283
|
+
error_class = Files.const_get(resp.data[:type].split("/").map { |piece| piece.split("-").map(&:capitalize).join('') + 'Error' }.join("::"))
|
284
|
+
error_class.new(error_data[:message], opts)
|
285
|
+
rescue NameError
|
290
286
|
APIError.new(error_data[:message], opts)
|
291
287
|
end
|
292
288
|
end
|
data/lib/files.com/errors.rb
CHANGED
@@ -26,16 +26,163 @@ module Files
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
class
|
29
|
+
class APIConnectionError < Error; end
|
30
30
|
class AuthenticationError < Error; end
|
31
|
-
class
|
32
|
-
class
|
31
|
+
class InvalidParameterError < Error; end
|
32
|
+
class MissingParameterError < Error; end
|
33
33
|
class NotImplementedError < Error; end
|
34
|
-
class PermissionError < Error; end
|
35
|
-
class RateLimitError < Error; end
|
36
|
-
class TooManyRequestsError < Error; end
|
37
|
-
class ValidationError < Error; end
|
38
34
|
|
39
|
-
class
|
40
|
-
|
35
|
+
class APIError < Error
|
36
|
+
attr_reader :detail
|
37
|
+
attr_reader :error
|
38
|
+
attr_reader :errors
|
39
|
+
attr_reader :http_code
|
40
|
+
attr_reader :instance
|
41
|
+
attr_reader :model_errors
|
42
|
+
attr_reader :title
|
43
|
+
attr_reader :type
|
44
|
+
|
45
|
+
def initialize(message = nil, **kwargs)
|
46
|
+
@detail = kwargs.dig(:json_body, 'detail')
|
47
|
+
@error = kwargs.dig(:json_body, 'error')
|
48
|
+
@errors = kwargs.dig(:json_body, 'errors')
|
49
|
+
@http_code = kwargs.dig(:json_body, 'http-code')
|
50
|
+
@instance = kwargs.dig(:json_body, 'instance')
|
51
|
+
@model_errors = kwargs.dig(:json_body, 'model_errors')
|
52
|
+
@title = kwargs.dig(:json_body, 'title')
|
53
|
+
@type = kwargs.dig(:json_body, 'type')
|
54
|
+
|
55
|
+
super(message, **kwargs)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class ProcessingPendingError < APIError; end
|
60
|
+
|
61
|
+
class AccountInBadStandingError < APIError; end
|
62
|
+
class AccountOverdueError < AccountInBadStandingError; end
|
63
|
+
|
64
|
+
class BadRequestError < APIError; end
|
65
|
+
class AttachmentTooLargeError < BadRequestError; end
|
66
|
+
class CannotDownloadDirectoryError < BadRequestError; end
|
67
|
+
class CantMoveWithMultipleLocationsError < BadRequestError; end
|
68
|
+
class DatetimeParseError < BadRequestError; end
|
69
|
+
class DestinationSameError < BadRequestError; end
|
70
|
+
class FolderMustNotBeAFileError < BadRequestError; end
|
71
|
+
class InvalidFilterCombinationError < BadRequestError; end
|
72
|
+
class InvalidFilterFieldError < BadRequestError; end
|
73
|
+
class InvalidInputEncodingError < BadRequestError; end
|
74
|
+
class InvalidInterfaceError < BadRequestError; end
|
75
|
+
class InvalidOauthError < BadRequestError; end
|
76
|
+
class InvalidOauthProviderError < BadRequestError; end
|
77
|
+
class InvalidReturnToUrlError < BadRequestError; end
|
78
|
+
class InvalidUploadOffsetError < BadRequestError; end
|
79
|
+
class InvalidUsernameOrPasswordError < BadRequestError; end
|
80
|
+
class OperationOnNonScimResourceError < BadRequestError; end
|
81
|
+
class UnsupportedHttpResponseFormatError < BadRequestError; end
|
82
|
+
class UnsupportedMediaTypeError < BadRequestError; end
|
83
|
+
class UserIdInvalidError < BadRequestError; end
|
84
|
+
class UserIdOnUserEndpointError < BadRequestError; end
|
85
|
+
class UserRequiredError < BadRequestError; end
|
86
|
+
|
87
|
+
class InvalidParamsError < APIError; end
|
88
|
+
class InvalidCursorError < InvalidParamsError; end
|
89
|
+
class NoValidInputParamsError < InvalidParamsError; end
|
90
|
+
class ReauthenticationNeededFieldsError < InvalidParamsError; end
|
91
|
+
class RequestParamPathCannotHaveTrailingWhitespaceError < InvalidParamsError; end
|
92
|
+
class RequestParamsContainInvalidCharacterError < InvalidParamsError; end
|
93
|
+
class RequestParamsInvalidError < InvalidParamsError; end
|
94
|
+
class RequestParamsRequiredError < InvalidParamsError; end
|
95
|
+
class UnsupportedCurrencyError < InvalidParamsError; end
|
96
|
+
|
97
|
+
class LockedError < APIError; end
|
98
|
+
class FileLockedError < LockedError; end
|
99
|
+
class FolderLockedError < LockedError; end
|
100
|
+
class ResourceLockedError < LockedError; end
|
101
|
+
class SubfolderLockedError < LockedError; end
|
102
|
+
|
103
|
+
class NotAuthenticatedError < APIError; end
|
104
|
+
class OneTimePasswordIncorrectError < NotAuthenticatedError; end
|
105
|
+
class TwoFactorAuthenticationErrorError < NotAuthenticatedError; end
|
106
|
+
class TwoFactorAuthenticationRequiredError < NotAuthenticatedError; end
|
107
|
+
class TwoFactorAuthenticationSetupExpiredError < NotAuthenticatedError; end
|
108
|
+
|
109
|
+
class NotAuthorizedError < APIError; end
|
110
|
+
class ApiKeyIsDisabledError < NotAuthorizedError; end
|
111
|
+
class ApiKeyIsPathRestrictedError < NotAuthorizedError; end
|
112
|
+
class ApiKeyOnlyForDesktopAppError < NotAuthorizedError; end
|
113
|
+
class ApiKeyOnlyForOfficeIntegrationError < NotAuthorizedError; end
|
114
|
+
class AuthenticationRequiredError < NotAuthorizedError; end
|
115
|
+
class CannotLoginWhileUsingKeyError < NotAuthorizedError; end
|
116
|
+
class CantActForOtherUserError < NotAuthorizedError; end
|
117
|
+
class ContactAdminForPasswordChangeHelpError < NotAuthorizedError; end
|
118
|
+
class FolderAdminOrBillingPermissionError < NotAuthorizedError; end
|
119
|
+
class FolderAdminPermissionRequiredError < NotAuthorizedError; end
|
120
|
+
class HistoryExportNonAdminsMustQueryByFolderOrPathError < NotAuthorizedError; end
|
121
|
+
class HistoryPermissionRequiredError < NotAuthorizedError; end
|
122
|
+
class InsufficientPermissionForParamsError < NotAuthorizedError; end
|
123
|
+
class LockedOutError < NotAuthorizedError; end
|
124
|
+
class LockoutRegionMismatchError < NotAuthorizedError; end
|
125
|
+
class MustAuthenticateWithApiKeyError < NotAuthorizedError; end
|
126
|
+
class NeedAdminPermissionForInboxError < NotAuthorizedError; end
|
127
|
+
class NoBillingPermissionError < NotAuthorizedError; end
|
128
|
+
class NotAllowedToCreateBundleError < NotAuthorizedError; end
|
129
|
+
class PasswordChangeNotRequiredError < NotAuthorizedError; end
|
130
|
+
class PasswordChangeRequiredError < NotAuthorizedError; end
|
131
|
+
class ReadOnlySessionError < NotAuthorizedError; end
|
132
|
+
class ReadPermissionRequiredError < NotAuthorizedError; end
|
133
|
+
class ReauthenticationFailedError < NotAuthorizedError; end
|
134
|
+
class ReauthenticationFailedFinalError < NotAuthorizedError; end
|
135
|
+
class ReauthenticationNeededActionError < NotAuthorizedError; end
|
136
|
+
class SelfManagedRequiredError < NotAuthorizedError; end
|
137
|
+
class UnauthorizedError < NotAuthorizedError; end
|
138
|
+
class UserIdWithoutSiteAdminError < NotAuthorizedError; end
|
139
|
+
class WritePermissionRequiredError < NotAuthorizedError; end
|
140
|
+
class ZipDownloadIpMismatchError < NotAuthorizedError; end
|
141
|
+
|
142
|
+
class NotFoundError < APIError; end
|
143
|
+
class ApiKeyNotFoundError < NotFoundError; end
|
144
|
+
class BundlePathNotFoundError < NotFoundError; end
|
145
|
+
class CodeNotFoundError < NotFoundError; end
|
146
|
+
class FileNotFoundError < NotFoundError; end
|
147
|
+
class FileUploadNotFoundError < NotFoundError; end
|
148
|
+
class FolderNotFoundError < NotFoundError; end
|
149
|
+
class GroupNotFoundError < NotFoundError; end
|
150
|
+
class HistoryExportNotReadyError < NotFoundError; end
|
151
|
+
class InboxNotFoundError < NotFoundError; end
|
152
|
+
class NestedNotFoundError < NotFoundError; end
|
153
|
+
class PlanNotFoundError < NotFoundError; end
|
154
|
+
class SiteNotFoundError < NotFoundError; end
|
155
|
+
class UserNotFoundError < NotFoundError; end
|
156
|
+
|
157
|
+
class ProcessingFailureError < APIError; end
|
158
|
+
class BundleRegistrationCodeFailedError < ProcessingFailureError; end
|
159
|
+
class DestinationExistsError < ProcessingFailureError; end
|
160
|
+
class DestinationParentConflictError < ProcessingFailureError; end
|
161
|
+
class DestinationParentDoesNotExistError < ProcessingFailureError; end
|
162
|
+
class FailedToChangePasswordError < ProcessingFailureError; end
|
163
|
+
class FileNotUploadedError < ProcessingFailureError; end
|
164
|
+
class FolderNotEmptyError < ProcessingFailureError; end
|
165
|
+
class HistoryExportFailureError < ProcessingFailureError; end
|
166
|
+
class HistoryUnavailableError < ProcessingFailureError; end
|
167
|
+
class InboxRegistrationCodeFailedError < ProcessingFailureError; end
|
168
|
+
class InvalidBundleCodeError < ProcessingFailureError; end
|
169
|
+
class InvalidOrExpiredCodeError < ProcessingFailureError; end
|
170
|
+
class ModelSaveErrorError < ProcessingFailureError; end
|
171
|
+
class RemoteServerErrorError < ProcessingFailureError; end
|
172
|
+
class TwoFactorAuthenticationCodeAlreadySentError < ProcessingFailureError; end
|
173
|
+
class UnprocessableEntityError < ProcessingFailureError; end
|
174
|
+
|
175
|
+
class RateLimitedError < APIError; end
|
176
|
+
class ReauthenticationRateLimitedError < RateLimitedError; end
|
177
|
+
class TooManyLoginAttemptsError < RateLimitedError; end
|
178
|
+
class TooManyRequestsError < RateLimitedError; end
|
179
|
+
|
180
|
+
class SiteConfigurationError < APIError; end
|
181
|
+
class AccountAlreadyExistsError < SiteConfigurationError; end
|
182
|
+
class NoAccountForSiteError < SiteConfigurationError; end
|
183
|
+
class SiteAdminRequiredError < SiteConfigurationError; end
|
184
|
+
class SiteWasRemovedError < SiteConfigurationError; end
|
185
|
+
class TrialExpiredError < SiteConfigurationError; end
|
186
|
+
class TrialLockedError < SiteConfigurationError; end
|
187
|
+
class UserRequestsEnabledRequiredError < SiteConfigurationError; end
|
41
188
|
end
|
data/lib/files.com/models/app.rb
CHANGED
@@ -64,6 +64,16 @@ module Files
|
|
64
64
|
@attributes[:external_homepage_url]
|
65
65
|
end
|
66
66
|
|
67
|
+
# string - Marketing video page
|
68
|
+
def marketing_youtube_url
|
69
|
+
@attributes[:marketing_youtube_url]
|
70
|
+
end
|
71
|
+
|
72
|
+
# string - Tutorial video page
|
73
|
+
def tutorial_youtube_url
|
74
|
+
@attributes[:tutorial_youtube_url]
|
75
|
+
end
|
76
|
+
|
67
77
|
# string - The type of the App
|
68
78
|
def app_type
|
69
79
|
@attributes[:app_type]
|
@@ -139,7 +139,7 @@ module Files
|
|
139
139
|
@attributes[:provision_site_admin_groups]
|
140
140
|
end
|
141
141
|
|
142
|
-
# boolean - Auto-provisioned users get Sharing permission
|
142
|
+
# boolean - DEPRECATED: Auto-provisioned users get Sharing permission. Use a Group with the Bundle permission instead.
|
143
143
|
def provision_attachments_permission
|
144
144
|
@attributes[:provision_attachments_permission]
|
145
145
|
end
|
@@ -45,7 +45,7 @@ module Files
|
|
45
45
|
@attributes[:allowed_ips] = value
|
46
46
|
end
|
47
47
|
|
48
|
-
# boolean - Can the user create Bundles (aka Share Links)?
|
48
|
+
# boolean - DEPRECATED: Can the user create Bundles (aka Share Links)? Use the bundle permission instead.
|
49
49
|
def attachments_permission
|
50
50
|
@attributes[:attachments_permission]
|
51
51
|
end
|
@@ -555,7 +555,7 @@ module Files
|
|
555
555
|
# password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
|
556
556
|
# announcements_read - boolean - Signifies that the user has read all the announcements in the UI.
|
557
557
|
# allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
|
558
|
-
# attachments_permission - boolean - Can the user create Bundles (aka Share Links)?
|
558
|
+
# attachments_permission - boolean - DEPRECATED: Can the user create Bundles (aka Share Links)? Use the bundle permission instead.
|
559
559
|
# authenticate_until - string - Scheduled Date/Time at which user will be deactivated
|
560
560
|
# authentication_method - string - How is this user authenticated?
|
561
561
|
# billing_permission - boolean - Allow this user to perform operations on the account, payments, and invoices?
|
@@ -713,7 +713,7 @@ module Files
|
|
713
713
|
# password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
|
714
714
|
# announcements_read - boolean - Signifies that the user has read all the announcements in the UI.
|
715
715
|
# allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
|
716
|
-
# attachments_permission - boolean - Can the user create Bundles (aka Share Links)?
|
716
|
+
# attachments_permission - boolean - DEPRECATED: Can the user create Bundles (aka Share Links)? Use the bundle permission instead.
|
717
717
|
# authenticate_until - string - Scheduled Date/Time at which user will be deactivated
|
718
718
|
# authentication_method - string - How is this user authenticated?
|
719
719
|
# billing_permission - boolean - Allow this user to perform operations on the account, payments, and invoices?
|
@@ -820,7 +820,7 @@ module Files
|
|
820
820
|
# password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
|
821
821
|
# announcements_read - boolean - Signifies that the user has read all the announcements in the UI.
|
822
822
|
# allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
|
823
|
-
# attachments_permission - boolean - Can the user create Bundles (aka Share Links)?
|
823
|
+
# attachments_permission - boolean - DEPRECATED: Can the user create Bundles (aka Share Links)? Use the bundle permission instead.
|
824
824
|
# authenticate_until - string - Scheduled Date/Time at which user will be deactivated
|
825
825
|
# authentication_method - string - How is this user authenticated?
|
826
826
|
# billing_permission - boolean - Allow this user to perform operations on the account, payments, and invoices?
|
data/lib/files.com/uri.rb
CHANGED
@@ -34,17 +34,11 @@ module Files
|
|
34
34
|
# here we need to, so switch to ASCII.
|
35
35
|
component = component.dup
|
36
36
|
component.force_encoding(Encoding::ASCII_8BIT)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
character_class,
|
43
|
-
leave_encoded
|
44
|
-
)
|
45
|
-
rescue ArgumentError
|
46
|
-
encoded = encode_component(unencoded)
|
47
|
-
end
|
37
|
+
encoded = Addressable::URI.encode_component(
|
38
|
+
component,
|
39
|
+
character_class,
|
40
|
+
leave_encoded
|
41
|
+
)
|
48
42
|
encoded.force_encoding(Encoding::UTF_8)
|
49
43
|
encoded
|
50
44
|
end
|
data/spec/uri_spec.rb
CHANGED
@@ -2,10 +2,14 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe Files::URI do
|
4
4
|
describe "normalized_path" do
|
5
|
-
it { expect(described_class.normalized_path("[[strange stuff]]#yes.text")).to eq("
|
5
|
+
it { expect(described_class.normalized_path("path/[[strange stuff]]#yes.text")).to eq("path/%5B%5Bstrange%20stuff%5D%5D%23yes.text") }
|
6
6
|
it { expect(Addressable::URI.unencode_component(described_class.normalized_path("[[strange stuff]]#yes.text"))).to eq("[[strange stuff]]#yes.text") }
|
7
7
|
|
8
8
|
it { expect(described_class.normalized_path("folder/AdÇe")).to eq("folder/AdC%CC%A7e") }
|
9
9
|
it { expect(Addressable::URI.unencode_component(described_class.normalized_path("AdÇe"))).to eq("AdÇe") }
|
10
|
+
|
11
|
+
it { expect(described_class.normalized_path("lorem%20ipsum.txt")).to eq("lorem%2520ipsum.txt") }
|
12
|
+
it { expect(described_class.normalized_path("lorem%ipsum.txt")).to eq("lorem%25ipsum.txt") }
|
13
|
+
it { expect(described_class.normalized_path("lorem ipsum.txt")).to eq("lorem%20ipsum.txt") }
|
10
14
|
end
|
11
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: files.com
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.138
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- files.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- _VERSION
|
86
86
|
- bin/files
|
87
87
|
- bin/files-console
|
88
|
+
- build.sh
|
88
89
|
- docs/account_line_item.md
|
89
90
|
- docs/action.md
|
90
91
|
- docs/api_key.md
|