canvas_link_migrator 1.0.5 → 1.0.6
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: bb741be0946fbad43cb23efadcbeb87d1338485b475cc2c3e699cfef07599263
|
4
|
+
data.tar.gz: f98e804aa56242fe5f08e123166f776b0f8f911b1590f541818ae6b70675395e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d88c62ed1c8db1c690599ed7f5640a5b516a701c1ee8cd18765a80f1860db104107c8b2135357d5f205a5d176e95fedd3090a9c0dc9c84641bf2f6163d356f2
|
7
|
+
data.tar.gz: 1a9439977136930dfd3b6ea3fdff6d767c772c3ea9107348f4ba51253b1a04710885b141dbb1764cca5c6985213a1131c42bb1bad8676227d9c04a0ef00423fa
|
@@ -108,6 +108,8 @@ module CanvasLinkMigrator
|
|
108
108
|
when :file
|
109
109
|
rel_path = link[:rel_path]
|
110
110
|
new_url = resolve_relative_file_url(rel_path)
|
111
|
+
# leave user urls alone
|
112
|
+
new_url ||= rel_path if is_relative_user_url(rel_path)
|
111
113
|
unless new_url
|
112
114
|
new_url = missing_relative_file_url(rel_path)
|
113
115
|
link[:missing_url] = new_url
|
@@ -255,5 +257,9 @@ module CanvasLinkMigrator
|
|
255
257
|
nil
|
256
258
|
end
|
257
259
|
end
|
260
|
+
|
261
|
+
def is_relative_user_url(rel_path)
|
262
|
+
rel_path.start_with?("/users/")
|
263
|
+
end
|
258
264
|
end
|
259
265
|
end
|
@@ -86,6 +86,16 @@ describe CanvasLinkMigrator::ImportedHtmlConverter do
|
|
86
86
|
expect(@converter.convert_exported_html(test_string)).to eq([%{<p>This is an image: <br><img src="#{@path}files/6/preview" alt=":("></p>}, nil])
|
87
87
|
end
|
88
88
|
|
89
|
+
it "leaves relative user attachments alone" do
|
90
|
+
test_string = %{<p> This is an image: <img src="/users/1/files/1/preview?verifier=someVerifier" alt="some_image"></p>}
|
91
|
+
expect(@converter.convert_exported_html(test_string)).to eq([test_string, nil])
|
92
|
+
end
|
93
|
+
|
94
|
+
it "leaves absolute user attachments alone" do
|
95
|
+
test_string = %{<p> This is an image: <img src="http://mycanvas.com/users/1/files/1/preview?verifier=someVerifier" alt="some_image"></p>}
|
96
|
+
expect(@converter.convert_exported_html(test_string)).to eq([test_string, nil])
|
97
|
+
end
|
98
|
+
|
89
99
|
it "finds an attachment by path" do
|
90
100
|
test_string = %{<p>This is an image: <br /><img src="%24IMS_CC_FILEBASE%24/test.png" alt=":(" /></p>}
|
91
101
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canvas_link_migrator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mysti Lilla
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2024-02-
|
14
|
+
date: 2024-02-27 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -152,7 +152,8 @@ files:
|
|
152
152
|
- test.sh
|
153
153
|
homepage:
|
154
154
|
licenses: []
|
155
|
-
metadata:
|
155
|
+
metadata:
|
156
|
+
source_code_uri: https://github.com/instructure/canvas_link_migrator
|
156
157
|
post_install_message:
|
157
158
|
rdoc_options: []
|
158
159
|
require_paths:
|