mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: server side support for upload:// markdown
This allows uploads to be specified using short sha1 hash instead of full URL Client side change is pending
This commit is contained in:
@ -1059,4 +1059,51 @@ HTML
|
||||
end
|
||||
end
|
||||
|
||||
describe "image decoding" do
|
||||
|
||||
it "can decode upload:// for default setup" do
|
||||
upload = Fabricate(:upload)
|
||||
|
||||
raw = <<~RAW
|
||||

|
||||
|
||||
- 
|
||||
|
||||
- test
|
||||
- 
|
||||
RAW
|
||||
|
||||
cooked = <<~HTML
|
||||
<p><img src="#{upload.url}" alt="upload"></p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><img src="#{upload.url}" alt="upload"></p>
|
||||
</li>
|
||||
<li>
|
||||
<p>test</p>
|
||||
<ul>
|
||||
<li><img src="#{upload.url}" alt="upload"></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
HTML
|
||||
|
||||
expect(PrettyText.cook(raw)).to eq(cooked.strip)
|
||||
end
|
||||
|
||||
it "can place a blank image if we can not find the upload" do
|
||||
|
||||
raw = ""
|
||||
|
||||
cooked = <<~HTML
|
||||
<p><img src="/images/transparent.png" alt="upload" data-orig-src="upload://abcABC.png"></p>
|
||||
HTML
|
||||
|
||||
puts PrettyText.cook(raw)
|
||||
|
||||
expect(PrettyText.cook(raw)).to eq(cooked.strip)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user