multiwoven-integrations 0.34.9 → 0.34.11
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4051aa0036dc3795ce89575e293c6d0c3e36cb57c143cc39b2c736e04f71461b
|
|
4
|
+
data.tar.gz: e15d6caa850f7de4dcd87b634bf83db384458ec66b24d19a01a5aa4df165b51a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb18eb994768e5dd301714c92b3400929620b53a5c344289b8cf3f66c2d3cf8d70d725cdeadd5b93b97e84c14610da5fc400b7e6f7b66669585fdb8e3f24a012
|
|
7
|
+
data.tar.gz: ee4334676f93a3790c6c1abcdcb76a42a0331deef422620bceb8357a194af2ef09fad9553f73332439384d67866ace0f697c8c75513fc7e05c0944dbff600379
|
|
@@ -14,6 +14,8 @@ module Multiwoven::Integrations::Source
|
|
|
14
14
|
|
|
15
15
|
if unstructured_data?(connection_config) || semistructured_data?(connection_config)
|
|
16
16
|
create_drive_connection(connection_config)
|
|
17
|
+
folder_name = connection_config[:folder_name]
|
|
18
|
+
build_query(folder_name)
|
|
17
19
|
else
|
|
18
20
|
create_connection(connection_config)
|
|
19
21
|
end
|
|
@@ -82,7 +84,8 @@ module Multiwoven::Integrations::Source
|
|
|
82
84
|
when /^#{DOWNLOAD_FILE_CMD}\s+(.+)$/
|
|
83
85
|
file_name = ::Regexp.last_match(1).strip
|
|
84
86
|
file_name = file_name.gsub(/^["']|["']$/, "") # Remove leading/trailing quotes
|
|
85
|
-
|
|
87
|
+
file_name = file_name.gsub("\\", "\\\\\\") # Escape backslashes
|
|
88
|
+
download_file_to_local(folder_name, file_name, sync_config.sync_id)
|
|
86
89
|
else
|
|
87
90
|
raise ArgumentError, "Invalid command. Supported commands: #{LIST_FILES_CMD}, #{DOWNLOAD_FILE_CMD} <file_path>"
|
|
88
91
|
end
|
|
@@ -108,7 +111,8 @@ module Multiwoven::Integrations::Source
|
|
|
108
111
|
end
|
|
109
112
|
end
|
|
110
113
|
|
|
111
|
-
def download_file_to_local(file_name, sync_id)
|
|
114
|
+
def download_file_to_local(folder_name, file_name, sync_id)
|
|
115
|
+
query = build_query(folder_name)
|
|
112
116
|
download_path = ENV["FILE_DOWNLOAD_PATH"]
|
|
113
117
|
file = if download_path
|
|
114
118
|
File.join(download_path, "syncs", sync_id, File.basename(file_name))
|
|
@@ -118,7 +122,7 @@ module Multiwoven::Integrations::Source
|
|
|
118
122
|
|
|
119
123
|
# Escape single quotes to prevent query injection
|
|
120
124
|
escaped_name = file_name.gsub("'", "\\\\'")
|
|
121
|
-
query = "
|
|
125
|
+
query = "#{query} and name = '#{escaped_name}'"
|
|
122
126
|
|
|
123
127
|
records = get_files(@google_drive, query, 1, 0)
|
|
124
128
|
raise StandardError, "File not found." if records.empty?
|
|
@@ -153,26 +157,25 @@ module Multiwoven::Integrations::Source
|
|
|
153
157
|
raise ArgumentError, "Specified folder does not exist" if response.files.empty?
|
|
154
158
|
|
|
155
159
|
parent_id = response.files.first.id
|
|
156
|
-
"'#{parent_id}' in parents"
|
|
160
|
+
"'#{parent_id}' in parents and mimeType != 'application/vnd.google-apps.folder'"
|
|
157
161
|
end
|
|
158
162
|
|
|
159
|
-
def get_files(client, query, limit,
|
|
163
|
+
def get_files(client, query, limit, _offset)
|
|
164
|
+
next_page_token = nil
|
|
160
165
|
total_fetched = 0
|
|
161
166
|
result = []
|
|
162
167
|
|
|
163
|
-
return result if offset.positive? && !@next_page_token
|
|
164
|
-
|
|
165
168
|
while total_fetched < limit
|
|
166
169
|
batch_limit = [MAX_PER_PAGE, limit - total_fetched].min
|
|
167
|
-
response = if
|
|
168
|
-
client.list_files(include_items_from_all_drives: true, supports_all_drives: true, q: query, fields: FIELDS, page_size: batch_limit, page_token:
|
|
170
|
+
response = if next_page_token
|
|
171
|
+
client.list_files(include_items_from_all_drives: true, supports_all_drives: true, q: query, fields: FIELDS, page_size: batch_limit, page_token: next_page_token)
|
|
169
172
|
else
|
|
170
173
|
client.list_files(include_items_from_all_drives: true, supports_all_drives: true, q: query, fields: FIELDS, page_size: batch_limit)
|
|
171
174
|
end
|
|
172
175
|
break if response.files.empty?
|
|
173
176
|
|
|
174
177
|
result.push(*response.files)
|
|
175
|
-
|
|
178
|
+
next_page_token = response.next_page_token
|
|
176
179
|
break unless response.next_page_token
|
|
177
180
|
|
|
178
181
|
total_fetched += response.files.size
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: multiwoven-integrations
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.34.
|
|
4
|
+
version: 0.34.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Subin T P
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|