[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 33/119: ews-subdirectoryp convenience function
From: |
Eric Schulte |
Subject: |
[elpa] 33/119: ews-subdirectoryp convenience function |
Date: |
Mon, 10 Mar 2014 16:57:11 +0000 |
eschulte pushed a commit to branch master
in repository elpa.
commit 6fc50728435c805825a22810974e9caafd247f4e
Author: Eric Schulte <address@hidden>
Date: Sat Dec 21 06:59:11 2013 -0700
ews-subdirectoryp convenience function
---
emacs-web-server.el | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/emacs-web-server.el b/emacs-web-server.el
index 2d276d5..2a176fd 100644
--- a/emacs-web-server.el
+++ b/emacs-web-server.el
@@ -278,5 +278,16 @@ Optionally explicitly set MIME-TYPE, otherwise it is
guessed by
(insert-file-contents-literally path)
(buffer-string)))))
+(defun ews-subdirectoryp (parent path)
+ "Check that PATH is a subdirectory of PARENT.
+If so return PATH, if not return nil."
+ (let* ((expanded (expand-file-name path))
+ (complete (if (string= (substring expanded -1) "/")
+ expanded
+ (concat expanded "/"))))
+ (and (>= (length complete) (length parent))
+ (string= parent (substring complete 0 (length parent)))
+ complete)))
+
(provide 'emacs-web-server)
;;; emacs-web-server.el ends here
- [elpa] 25/119: seems to be generally usable, added a README, (continued)
- [elpa] 25/119: seems to be generally usable, added a README, Eric Schulte, 2014/03/10
- [elpa] 24/119: parse application/x-www-form-urlencoded post data, Eric Schulte, 2014/03/10
- [elpa] 26/119: thread proc through some functions, Eric Schulte, 2014/03/10
- [elpa] 28/119: testing a hello-world server, Eric Schulte, 2014/03/10
- [elpa] 27/119: run test processes asynch, Eric Schulte, 2014/03/10
- [elpa] 29/119: update examples, Eric Schulte, 2014/03/10
- [elpa] 31/119: match more HTTP methods, Eric Schulte, 2014/03/10
- [elpa] 30/119: fleshed out some more tests, Eric Schulte, 2014/03/10
- [elpa] 32/119: url-encoded parameters, Eric Schulte, 2014/03/10
- [elpa] 34/119: found a confounding POST example, Eric Schulte, 2014/03/10
- [elpa] 33/119: ews-subdirectoryp convenience function,
Eric Schulte <=
- [elpa] 36/119: bug fix, Eric Schulte, 2014/03/10
- [elpa] 35/119: cleaned up header/param parsing, Eric Schulte, 2014/03/10
- [elpa] 37/119: fixed tests, running and passing, Eric Schulte, 2014/03/10
- [elpa] 39/119: removed extra comments from examples, Eric Schulte, 2014/03/10
- [elpa] 40/119: moving around examples, Eric Schulte, 2014/03/10
- [elpa] 42/119: Makefile integration, Eric Schulte, 2014/03/10
- [elpa] 44/119: note, Eric Schulte, 2014/03/10
- [elpa] 43/119: more, Eric Schulte, 2014/03/10
- [elpa] 41/119: including examples in documentation, Eric Schulte, 2014/03/10
- [elpa] 47/119: even more documentation and examples, Eric Schulte, 2014/03/10