api2convert 10.3.0 → 10.3.2
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.
- checksums.yaml +4 -4
- data/README.md +29 -0
- data/docs/CHANGELOG.md +28 -0
- data/lib/api2convert/config.rb +1 -1
- data/lib/api2convert/result.rb +1 -1
- data/lib/api2convert/support/strings.rb +23 -0
- data/lib/api2convert/upload/file_uploader.rb +1 -1
- data/lib/api2convert/version.rb +1 -1
- data/lib/api2convert.rb +1 -0
- 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: 7b3813dd8314612f6d7b87b5eeb108be94bed5978da2107651414fec83bc1450
|
|
4
|
+
data.tar.gz: e5b33c01144af84acd534eae3fcc5ab12d51ab36f861aaacfa0a437b3d40f107
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6b8fa42db82e724bfd66f835c01349e70eb6c2265b0a5b493d15a54d86530d6cbd0d364a2bd49fe3cbda7d2f82dd99cb25350684fbb120c23d1daf57539b468b
|
|
7
|
+
data.tar.gz: 77772316f9261aeb355a2043dbd440369e2bd3e85b421526bb155836e308efbdb2ac052c434bccf6d90ce45220bc103c137a2a3ac59ee877bb86b1b2ba6372d3
|
data/README.md
CHANGED
|
@@ -87,6 +87,35 @@ rescue Api2Convert::SignatureVerificationError
|
|
|
87
87
|
end
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
## Cloud storage
|
|
91
|
+
|
|
92
|
+
Read an input straight from your own cloud storage, and/or deliver the output
|
|
93
|
+
into a bucket — no local upload or download in between (shipped in 10.3.0).
|
|
94
|
+
|
|
95
|
+
```ruby
|
|
96
|
+
# Input from S3: import the source and save the converted result locally
|
|
97
|
+
input = Api2Convert::Model::CloudInput.amazon_s3(
|
|
98
|
+
bucket: "my-bucket",
|
|
99
|
+
file: "invoices/report.docx",
|
|
100
|
+
accesskeyid: "AKIA…",
|
|
101
|
+
secretaccesskey: "…"
|
|
102
|
+
)
|
|
103
|
+
client.convert(input, "pdf").save("report.pdf")
|
|
104
|
+
|
|
105
|
+
# Output to S3: deliver the result into a bucket (generic OutputTarget)
|
|
106
|
+
target = Api2Convert::Model::OutputTarget.of(
|
|
107
|
+
Api2Convert::CloudProvider::AMAZON_S3,
|
|
108
|
+
parameters: { "bucket" => "my-bucket", "file" => "out/report.pdf" },
|
|
109
|
+
credentials: { "accesskeyid" => "AKIA…", "secretaccesskey" => "…" }
|
|
110
|
+
)
|
|
111
|
+
client.convert("report.docx", "pdf", output_targets: [target])
|
|
112
|
+
# Delivered to the bucket — the job completes with no local output to save.
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`azure`, `ftp` and `google_cloud` have matching input factories; output uses the
|
|
116
|
+
generic `OutputTarget` for every provider. Credentials are redacted in
|
|
117
|
+
`inspect`/errors and never printed.
|
|
118
|
+
|
|
90
119
|
## Error handling
|
|
91
120
|
|
|
92
121
|
```ruby
|
data/docs/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,34 @@ All notable changes to the API2Convert Ruby SDK are documented here. The five
|
|
|
4
4
|
official SDKs (PHP, Python, Java, Node.js, Ruby) version together against the
|
|
5
5
|
shared [`SDK_CONTRACT.md`](SDK_CONTRACT.md).
|
|
6
6
|
|
|
7
|
+
## [10.3.2] - 2026-08-12
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Replaced the trailing-separator regex trims (`%r{/+\z}`) in `config.rb`, `result.rb` and
|
|
12
|
+
`file_uploader.rb` with a linear reverse scan (`Support::Strings.trim_trailing`). CodeQL
|
|
13
|
+
flagged the patterns as polynomial ReDoS: a string ending in a long run of separators cost
|
|
14
|
+
O(n²), and `job.server` comes from the API while `base_url` comes from caller config.
|
|
15
|
+
Identical semantics, linear time.
|
|
16
|
+
|
|
17
|
+
## [10.3.1] - 2026-07-12
|
|
18
|
+
|
|
19
|
+
- Ships the cloud-storage examples added to the README (READMEs are included in the published
|
|
20
|
+
gem). No functional or API change from 10.3.0.
|
|
21
|
+
|
|
22
|
+
## [10.3.0] - 2026-07-12
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- Cloud-storage connectors: typed `CloudInput` + `OutputTarget` (SDK contract D-5).
|
|
27
|
+
- On-brand `x-api2convert-*` request headers.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- Bounded the control-plane response-body read; atomic save, download error typing and numeric
|
|
32
|
+
overflow safety (Track B robustness); a 3xx on the authenticated JSON path now raises a typed
|
|
33
|
+
error instead of returning an empty model.
|
|
34
|
+
|
|
7
35
|
## [10.2.1] - 2026-07-08
|
|
8
36
|
|
|
9
37
|
- Lock-step version bump to keep all API2Convert SDKs on 10.2.1. No library changes since 10.2.0
|
data/lib/api2convert/config.rb
CHANGED
|
@@ -41,7 +41,7 @@ module Api2Convert
|
|
|
41
41
|
|
|
42
42
|
new(
|
|
43
43
|
api_key: api_key,
|
|
44
|
-
base_url: (base_url.nil? ? DEFAULT_BASE_URL : base_url
|
|
44
|
+
base_url: Support::Strings.trim_trailing(base_url.nil? ? DEFAULT_BASE_URL : base_url, "/"),
|
|
45
45
|
timeout: [1, (timeout.nil? ? 30 : timeout).to_i].max,
|
|
46
46
|
max_retries: [0, (max_retries.nil? ? 2 : max_retries).to_i].max,
|
|
47
47
|
poll_interval: interval,
|
data/lib/api2convert/result.rb
CHANGED
|
@@ -128,7 +128,7 @@ module Api2Convert
|
|
|
128
128
|
path_or_dir.end_with?(File::SEPARATOR)
|
|
129
129
|
if looks_like_dir
|
|
130
130
|
name = safe_name(@output.filename) || safe_name(@output.id) || "output"
|
|
131
|
-
return File.join(
|
|
131
|
+
return File.join(Support::Strings.trim_trailing(path_or_dir, "/\\"), name)
|
|
132
132
|
end
|
|
133
133
|
path_or_dir
|
|
134
134
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Api2Convert
|
|
4
|
+
module Support
|
|
5
|
+
# Small string helpers shared across the SDK. Internal, not part of the public API.
|
|
6
|
+
module Strings
|
|
7
|
+
module_function
|
|
8
|
+
|
|
9
|
+
# Strip every trailing character contained in +chars+ from +value+.
|
|
10
|
+
#
|
|
11
|
+
# Deliberately a scan rather than a regex: %r{/+\z} and friends backtrack, so a
|
|
12
|
+
# string ending in a long run of separators costs O(n^2) to match (CodeQL's
|
|
13
|
+
# +rb/polynomial-redos+). +job.server+ arrives from the API and +base_url+ from
|
|
14
|
+
# caller config, so neither is worth a quadratic path. This is a single reverse
|
|
15
|
+
# scan — O(n), no backtracking, identical result.
|
|
16
|
+
def trim_trailing(value, chars)
|
|
17
|
+
last = value.length
|
|
18
|
+
last -= 1 while last.positive? && chars.include?(value[last - 1])
|
|
19
|
+
last == value.length ? value : value[0, last]
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -29,7 +29,7 @@ module Api2Convert
|
|
|
29
29
|
|
|
30
30
|
io, resolved_name, opened = resolve(file, filename)
|
|
31
31
|
seekable = io.respond_to?(:rewind)
|
|
32
|
-
url = "#{job.server
|
|
32
|
+
url = "#{Support::Strings.trim_trailing(job.server, "/")}/upload-file/#{job.id}"
|
|
33
33
|
token = job.token
|
|
34
34
|
boundary = "----Api2Convert#{SecureRandom.hex(16)}"
|
|
35
35
|
|
data/lib/api2convert/version.rb
CHANGED
data/lib/api2convert.rb
CHANGED
|
@@ -20,6 +20,7 @@ require_relative "api2convert/version"
|
|
|
20
20
|
require_relative "api2convert/errors"
|
|
21
21
|
require_relative "api2convert/config"
|
|
22
22
|
require_relative "api2convert/support/data"
|
|
23
|
+
require_relative "api2convert/support/strings"
|
|
23
24
|
require_relative "api2convert/support/secret"
|
|
24
25
|
require_relative "api2convert/support/redactor"
|
|
25
26
|
require_relative "api2convert/job_status"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: api2convert
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 10.3.
|
|
4
|
+
version: 10.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Qaamgo Media GmbH
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-08-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Convert, compress and transform images, documents, audio, video, ebooks,
|
|
14
14
|
archives and CAD — and run operations like OCR, merge, thumbnail and website capture
|
|
@@ -73,6 +73,7 @@ files:
|
|
|
73
73
|
- lib/api2convert/support/data.rb
|
|
74
74
|
- lib/api2convert/support/redactor.rb
|
|
75
75
|
- lib/api2convert/support/secret.rb
|
|
76
|
+
- lib/api2convert/support/strings.rb
|
|
76
77
|
- lib/api2convert/upload/file_uploader.rb
|
|
77
78
|
- lib/api2convert/upload/multipart_stream.rb
|
|
78
79
|
- lib/api2convert/version.rb
|