multipart_form_data_parser 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +24 -0
- data/lib/multipart_form_data_parser/version.rb +3 -0
- data/lib/multipart_form_data_parser.rb +23 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b2de3d5864aa4b4cf3379248785e85ef1c7b3130883eae078c94247a29ccde79
|
4
|
+
data.tar.gz: e546144c9c4820fea2893d92aaba5c5bf3a5c7457b271541a8dde0f233c77494
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cabb79d2f3af97afde5db3d00062eb78181ba828eb7236b60d6a32b515b3687ebd3b7e462ba0da08976e7a3e8aee161db34d36dda9a8dfdd20fadbe726e3b4d8
|
7
|
+
data.tar.gz: 1f948b8f8230dc4d959260dd911900873ed5a3a0cc2e20796ad6fb37e81bb147df9a0f6a8c0bb5ec87b5497083e1b27bdf93db23951f3dd74a39199a6a9c6627
|
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# multipart_form_data_parser
|
2
|
+
|
3
|
+
Multipart form data parser for Ruby and Rails applications
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add the gem to your Gemfile
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem "multipart_form_data_parser"
|
11
|
+
```
|
12
|
+
|
13
|
+
and install the gem
|
14
|
+
|
15
|
+
```
|
16
|
+
bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
content_type = "multipart/form-data; boundary=xYzZY"
|
23
|
+
MultipartFormDataParser.parse(multipart_form_data, content_type)
|
24
|
+
```
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# require "rack/multipart"
|
2
|
+
# require "rack/utils"
|
3
|
+
|
4
|
+
require "rack"
|
5
|
+
|
6
|
+
class MultipartFormDataParser
|
7
|
+
class << self
|
8
|
+
# @example
|
9
|
+
# content_type = "multipart/form-data; boundary=xYzZY"
|
10
|
+
# MultipartFormDataParser.parse(multipart_form_data, content_type)
|
11
|
+
def parse(multipart_form_data, content_type)
|
12
|
+
sanitized_multipart_form_data = multipart_form_data.gsub(/\r?\n/, "\r\n")
|
13
|
+
|
14
|
+
io = StringIO.new(sanitized_multipart_form_data)
|
15
|
+
tempfile = Rack::Multipart::Parser::TEMPFILE_FACTORY
|
16
|
+
bufsize = Rack::Multipart::Parser::BUFSIZE
|
17
|
+
query_parser = Rack::Utils.default_query_parser
|
18
|
+
Rack::Multipart::Parser.parse(io, sanitized_multipart_form_data.length, content_type, tempfile, bufsize, query_parser)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
require_relative "multipart_form_data_parser/version"
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: multipart_form_data_parser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nisanth Chunduru
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-08-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rack
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Multipart form data parser
|
56
|
+
email:
|
57
|
+
- nisanth074@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- README.md
|
63
|
+
- lib/multipart_form_data_parser.rb
|
64
|
+
- lib/multipart_form_data_parser/version.rb
|
65
|
+
homepage: https://github.com/nisanth074/c
|
66
|
+
licenses: []
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubygems_version: 3.1.6
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Multipart form data parser
|
87
|
+
test_files: []
|