| 929 | } |
| 930 | |
| 931 | function finalize_source(source, format, url_suffix) { |
| 932 | let source_to_sign; |
| 933 | source = source.replace(/([^:])\/\//g, '$1/'); |
| 934 | if (source.match(/^https?:\//i)) { |
| 935 | source = smart_escape(source); |
| 936 | source_to_sign = source; |
| 937 | } else { |
| 938 | source = encodeURIComponent(decodeURIComponent(source)).replace(/%3A/g, ":").replace(/%2F/g, "/"); |
| 939 | source_to_sign = source; |
| 940 | if (url_suffix) { |
| 941 | if (url_suffix.match(/[\.\/]/)) { |
| 942 | throw new Error('url_suffix should not include . or /'); |
| 943 | } |
| 944 | source = source + '/' + url_suffix; |
| 945 | } |
| 946 | if (format != null) { |
| 947 | source = source + '.' + format; |
| 948 | source_to_sign = source_to_sign + '.' + format; |
| 949 | } |
| 950 | } |
| 951 | return [source, source_to_sign]; |
| 952 | } |
| 953 | |
| 954 | function video_thumbnail_url(public_id, options) { |
| 955 | options = extend({}, DEFAULT_POSTER_OPTIONS, options); |