rbbt-rest 1.8.142 → 1.8.143

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41d4cc31577331447eb862dab40cfa0579535cebe63f5a8a18fa15faf0e52903
4
- data.tar.gz: 9df9b6195d6c3c7cb67f3d36055013c1024c197584a59a25321804d58b8b1575
3
+ metadata.gz: b6fed7211306df3aec52b9f2e1417c6ce42134377d8a48dabe12b9afde64835f
4
+ data.tar.gz: a93c9017255ff8495cda997bbccd816e9ee4fb01eb7023e8436454593b628c7e
5
5
  SHA512:
6
- metadata.gz: 90c5a597c253cf60af21c149c0671973a3b1c0d1012b592f300f87e7fb84dedae70989ef632740dcb9f0cca5dfa8198c44268012393e6c7ecf9aa1b71122e4e0
7
- data.tar.gz: f4019b6940791f2a2b54a7a70aad1ec7c1eb27c135f516362fd6289b7ff7785ae2c236321d6f403dc6017275aae36c03ed12a23bfecbb29d0f04abb3dec763a3
6
+ metadata.gz: c4b013bb24c9061c734cc1b8851457f614c799a73d08454d99d15e468a0771ad5da9d548416f3aa1ba810d34f36b34eeee2bc3e0d582e073a6cc83100afc10f7
7
+ data.tar.gz: d7c81039ebcdcf20d0d4ff8284cee946f47b1fbf6e2ae0680ee8d2ec60c6aa23c8efa8fff09cffd8a64f0b5d4e1c96e1869d895dbdbb61b244cbbe35f0bb0d0d
@@ -128,7 +128,7 @@ module RbbtRESTHelpers
128
128
 
129
129
  halt 200, hash.to_json
130
130
  when "table"
131
- halt 200, tsv2html(fragment_file)
131
+ halt_html tsv2html(fragment_file)
132
132
  when "json"
133
133
  content_type "application/json"
134
134
  halt 200, tsv_process(load_tsv(fragment_file).first).to_json
@@ -181,7 +181,6 @@ module RbbtRESTHelpers
181
181
  require 'rbbt/tsv/excel'
182
182
  tsv, tsv_options = load_tsv(fragment_file)
183
183
  tsv = tsv_process(tsv)
184
- content_type "text/html"
185
184
  data = nil
186
185
  excel_file = TmpFile.tmp_file
187
186
  tsv.excel(excel_file, :sort_by => @excel_sort_by, :sort_by_cast => @excel_sort_by_cast, :name => true, :remove_links => true)
@@ -235,6 +234,8 @@ data = NULL
235
234
  rescue
236
235
  end
237
236
  end
237
+ else
238
+ txt = nil
238
239
  end
239
240
 
240
241
  if mime
@@ -243,10 +244,14 @@ data = NULL
243
244
  content_type "text/plain"
244
245
  end
245
246
 
246
- if File.exists? fragment_file
247
- send_file fragment_file
247
+ if mime && mime.to_s.include?("text/html")
248
+ halt_html txt || Open.read(fragment_file)
248
249
  else
249
- halt 200, Open.read(fragment_file)
250
+ if File.exists?(fragment_file)
251
+ send_file fragment_file
252
+ else
253
+ halt 200, Open.read(fragment_file)
254
+ end
250
255
  end
251
256
  end
252
257
  elsif Open.exists?(fragment_file + '.error')
@@ -298,6 +298,21 @@ module RbbtRESTHelpers
298
298
  FileUtils.ln_s(path, dest)
299
299
  "/permalink/#{ id }"
300
300
  end
301
+
302
+ def fix_html(html)
303
+ if html !~ /^\s*<html/i
304
+ "<html><meta charset=#{html.encoding.to_s}/><body>" + html + "<body/><html/>"
305
+ else
306
+ html
307
+ end
308
+ end
309
+
310
+ def halt_html(html, response = 200)
311
+ content_type "text/html; charset=#{html.encoding.to_s}"
312
+ html = fix_html html
313
+ halt response, html
314
+ end
315
+
301
316
  end
302
317
 
303
318
  require 'haml'
@@ -23,7 +23,6 @@
23
23
  - info = card.entity.info
24
24
  - info.delete :annotation_types
25
25
  - if info.any? or card.meta or card.list_container
26
- - empty = false
27
26
  .meta
28
27
  - if info.any?
29
28
  %h3 Meta data
@@ -33,8 +32,10 @@
33
32
  - case card.meta
34
33
  - when nil
35
34
  - when Hash
35
+ - empty = false
36
36
  = hash2dl(card.meta)
37
37
  - when Proc
38
+ - empty = false
38
39
  = fragment :meta, &card.meta
39
40
 
40
41
  - if card.list_container
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.142
4
+ version: 1.8.143
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-17 00:00:00.000000000 Z
11
+ date: 2020-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -269,7 +269,6 @@ files:
269
269
  - share/views/layout/top_menu/favourites.haml
270
270
  - share/views/layout/top_menu/finder.haml
271
271
  - share/views/layout/top_menu/user.haml
272
- - share/views/main.haml
273
272
  - share/views/monitor/jobs.haml
274
273
  - share/views/monitor/locks.haml
275
274
  - share/views/partials/dependencies.haml
File without changes