Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#46491] handle NC usernames with whitespaces

Eric Schubertcae3d1600db0
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb
index ea70dcc5386..88cea3ac198 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb
@@ -33,7 +33,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
@uri = base_uri
@token = token
@retry_proc = retry_proc
- @base_path = File.join(@uri.path, "remote.php/dav/files", token.origin_user_id)
+ @base_path = File.join(@uri.path, "remote.php/dav/files", escape_whitespace(token.origin_user_id))
end
def query(parent)
@@ -58,12 +58,17 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
private
+ def escape_whitespace(value)
+ value.gsub(' ', '%20')
+ end
+
def requested_folder(folder)
return '' if folder.nil?
- folder.gsub(' ', '%20')
+ escape_whitespace(folder)
end
+ # rubocop:disable Metrics/AbcSize
def requested_properties
Nokogiri::XML::Builder.new do |xml|
xml['d'].propfind(
@@ -81,6 +86,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
end
end.to_xml
end
+ # rubocop:enable Metrics/AbcSize
def error(response)
case response