From 548627c40485ff0d688418296dcffcdfcb0016d7 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 1 May 2012 14:47:44 -0600 Subject: [PATCH] scribble/eval: change string or byte-string expression handling Use `datum->syntax' instead of `begin' to protect the string or byte string. Danny Yoo suggested this change. original commit: 23296615ec7cddb34257486b62094048b085ff6e --- collects/scribble/eval.rkt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/collects/scribble/eval.rkt b/collects/scribble/eval.rkt index 9d20f5d2..96a8fab0 100644 --- a/collects/scribble/eval.rkt +++ b/collects/scribble/eval.rkt @@ -372,8 +372,10 @@ (syntax-case s (module) [(module . _rest) (syntax->datum s)] [_else s])] - [(bytes? s) `(begin ,s)] - [(string? s) `(begin ,s)] + ;; a sandbox treats strings and byte strings as code + ;; streams, so protect them as syntax objects: + [(string? s) (datum->syntax #f s)] + [(bytes? s) (datum->syntax #f s)] [else s])))) list)))