markdownr 0.6.10 → 0.6.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 +4 -4
- data/lib/markdown_server/app.rb +31 -21
- data/lib/markdown_server/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 072ccb5cc0d25d1b06e7fc40cc51a6d4d71a03627fbf6569a822782a4151c8a4
|
|
4
|
+
data.tar.gz: '039ec59649a81611b158230190dee9c02343dc7fbbdf97008b8b05a116eecc66'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eb6dab68fec96f02ff6c3c1243196d64166e489e78ea2ffc77423bb808d8737e52850fc51dadebe415a0258f8f53f2ed6bc42232efadca6b328620efe46853e5
|
|
7
|
+
data.tar.gz: 48f192f288f773f9fddc677fc68e0bc856f63780f4fa1e983bfbb2376d4b2be2ef2c4c520c95ba5988af2693cd2cced5ed599cea090948f28ae73d345a6db0a0
|
data/lib/markdown_server/app.rb
CHANGED
|
@@ -216,23 +216,30 @@ module MarkdownServer
|
|
|
216
216
|
def resolve_wiki_link(name)
|
|
217
217
|
filename = "#{name}.md"
|
|
218
218
|
base = File.realpath(root_dir)
|
|
219
|
+
# On case-sensitive filesystems (Linux/Docker), FNM_CASEFOLD doesn't help
|
|
220
|
+
# with directory listings. Try exact filename first, then lowercased variant.
|
|
221
|
+
candidates = [filename]
|
|
222
|
+
candidates << filename.downcase if filename != filename.downcase
|
|
219
223
|
|
|
220
224
|
# Check the current file's directory first (exact case, then case-insensitive)
|
|
221
225
|
if @current_wiki_dir
|
|
222
226
|
local_exact = nil
|
|
223
227
|
local_ci = nil
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
228
|
+
candidates.each do |fn|
|
|
229
|
+
Dir.glob(File.join(@current_wiki_dir, fn)).each do |path|
|
|
230
|
+
real = File.realpath(path) rescue next
|
|
231
|
+
next unless real.start_with?(base)
|
|
232
|
+
relative = real.sub("#{base}/", "")
|
|
233
|
+
first_segment = relative.split("/").first
|
|
234
|
+
next if EXCLUDED.include?(first_segment) || first_segment&.start_with?(".")
|
|
235
|
+
if File.basename(real) == filename
|
|
236
|
+
local_exact = relative
|
|
237
|
+
break
|
|
238
|
+
else
|
|
239
|
+
local_ci ||= relative
|
|
240
|
+
end
|
|
235
241
|
end
|
|
242
|
+
break if local_exact
|
|
236
243
|
end
|
|
237
244
|
return local_exact if local_exact
|
|
238
245
|
return local_ci if local_ci
|
|
@@ -241,17 +248,20 @@ module MarkdownServer
|
|
|
241
248
|
# Fall back to global recursive search
|
|
242
249
|
exact_match = nil
|
|
243
250
|
ci_match = nil
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
candidates.each do |fn|
|
|
252
|
+
Dir.glob(File.join(base, "**", fn)).each do |path|
|
|
253
|
+
real = File.realpath(path) rescue next
|
|
254
|
+
next unless real.start_with?(base)
|
|
255
|
+
relative = real.sub("#{base}/", "")
|
|
256
|
+
first_segment = relative.split("/").first
|
|
257
|
+
next if EXCLUDED.include?(first_segment) || first_segment&.start_with?(".")
|
|
258
|
+
if File.basename(real) == filename
|
|
259
|
+
exact_match ||= relative
|
|
260
|
+
else
|
|
261
|
+
ci_match ||= relative
|
|
262
|
+
end
|
|
254
263
|
end
|
|
264
|
+
break if exact_match
|
|
255
265
|
end
|
|
256
266
|
|
|
257
267
|
exact_match || ci_match
|