@@ -200,8 +200,8 @@ pub struct JobConfig {
200200 pub compliant : bool ,
201201}
202202
203- pub fn strip_whitespace ( s : String ) -> String {
204- s. replace ( " " , "" )
203+ pub fn sanitize_input ( s : String ) -> String {
204+ format ! ( "'{}'" , s. replace( "' " , "" ) )
205205}
206206
207207impl JobConfig {
@@ -226,13 +226,13 @@ impl JobConfig {
226226
227227 if let Some ( locus) = self . locus {
228228 if !locus. is_empty ( ) {
229- parameters. push ( format ! ( "--locus {}" , strip_whitespace ( locus) ) ) ;
229+ parameters. push ( format ! ( "--locus {}" , sanitize_input ( locus) ) ) ;
230230 }
231231 }
232232
233233 if let Some ( locus_tag) = self . locus_tag {
234234 if !locus_tag. is_empty ( ) {
235- parameters. push ( format ! ( "--locus-tag {}" , strip_whitespace ( locus_tag) ) ) ;
235+ parameters. push ( format ! ( "--locus-tag {}" , sanitize_input ( locus_tag) ) ) ;
236236 }
237237 }
238238
@@ -242,25 +242,25 @@ impl JobConfig {
242242
243243 if let Some ( genus) = self . genus {
244244 if !genus. is_empty ( ) {
245- parameters. push ( format ! ( "--genus {}" , strip_whitespace ( genus) ) ) ;
245+ parameters. push ( format ! ( "--genus {}" , sanitize_input ( genus) ) ) ;
246246 }
247247 }
248248
249249 if let Some ( species) = self . species {
250250 if !species. is_empty ( ) {
251- parameters. push ( format ! ( "--species {}" , strip_whitespace ( species) ) ) ;
251+ parameters. push ( format ! ( "--species {}" , sanitize_input ( species) ) ) ;
252252 }
253253 }
254254
255255 if let Some ( strain) = self . strain {
256256 if !strain. is_empty ( ) {
257- parameters. push ( format ! ( "--strain {}" , strip_whitespace ( strain) ) ) ;
257+ parameters. push ( format ! ( "--strain {}" , sanitize_input ( strain) ) ) ;
258258 }
259259 }
260260
261261 if let Some ( plasmid) = self . plasmid {
262262 if !plasmid. is_empty ( ) {
263- parameters. push ( format ! ( "--plasmid {}" , strip_whitespace ( plasmid) ) ) ;
263+ parameters. push ( format ! ( "--plasmid {}" , sanitize_input ( plasmid) ) ) ;
264264 }
265265 }
266266
0 commit comments